SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 09/01/2019, 03:12 PM   #1
CherryMond
Little Clucker
 
CherryMond's Avatar
 
Join Date: Feb 2018
Posts: 28
Reputation: 0
Default Tuning, paintjobs etc. places - disable

Hi, I've problem.

I tried make disable tuning etc. places for private vehicles, but it is not working.
I won't creating new object, because this will be working on default vehicles. Somebody have any ideas?

PHP Code:
public OnEnterExitModShop(playeridenterexitinteriorid){
       if(
enterexit == 1){
    new 
VehicleID GetPlayerVehicleID(playerid);
        if(
IfPlayerInPrivateVehicle(playeridVehicleID)){
            
SetVehiclePos(VehicleIDstartPos[VehicleID][0], startPos[VehicleID][1], startPos[VehicleID][2]);
            
SetPlayerInterior(playerid0);
            
LinkVehicleToInterior(VehicleID0);            
            
SetVehicleVirtualWorld(VehicleID0);
            
SetPlayerVirtualWorld(playerid0);
            
SetVehicleZAngle(VehicleID45.0000);
            
SetCameraBehindPlayer(playerid);
            
SendClientMessage(playeridC_RED"You cannot modify this car!");            
            return 
1;
        }
    }
    return 
1;

CherryMond is offline   Reply With Quote
Old 09/01/2019, 06:39 PM   #2
Kevinas100
Little Clucker
 
Join Date: Oct 2015
Posts: 36
Reputation: 7
Default Re: Tuning, paintjobs etc. places - disable

Quote:
Originally Posted by CherryMond View Post
Hi, I've problem.

I tried make disable tuning etc. places for private vehicles, but it is not working.
I won't creating new object, because this will be working on default vehicles. Somebody have any ideas?

PHP Code:
public OnEnterExitModShop(playeridenterexitinteriorid){
       if(
enterexit == 1){
    new 
VehicleID GetPlayerVehicleID(playerid);
        if(
IfPlayerInPrivateVehicle(playeridVehicleID)){
            
SetVehiclePos(VehicleIDstartPos[VehicleID][0], startPos[VehicleID][1], startPos[VehicleID][2]);
            
SetPlayerInterior(playerid0);
            
LinkVehicleToInterior(VehicleID0);            
            
SetVehicleVirtualWorld(VehicleID0);
            
SetPlayerVirtualWorld(playerid0);
            
SetVehicleZAngle(VehicleID45.0000);
            
SetCameraBehindPlayer(playerid);
            
SendClientMessage(playeridC_RED"You cannot modify this car!");            
            return 
1;
        }
    }
    return 
1;

Did you try to put it under onplayerentermodshop?
Kevinas100 is offline   Reply With Quote
Old 09/01/2019, 07:35 PM   #3
CherryMond
Little Clucker
 
CherryMond's Avatar
 
Join Date: Feb 2018
Posts: 28
Reputation: 0
Default Re: Tuning, paintjobs etc. places - disable

what do you mean by writing "under onenterexitmodshop"? change of vehicle position or what?
CherryMond is offline   Reply With Quote
Old 09/01/2019, 07:42 PM   #4
Chyakka
Big Clucker
 
Join Date: Jul 2015
Location: England
Posts: 61
Reputation: 10
Default Re: Tuning, paintjobs etc. places - disable

Write out a
Code:
print("Debug");
before the if statement to confirm the callback is being correctly called. Assuming it is, the issue could be your IfPlayerInPrivateVehicle function, could you post it?
Chyakka is offline   Reply With Quote
Old 09/01/2019, 07:54 PM   #5
CherryMond
Little Clucker
 
CherryMond's Avatar
 
Join Date: Feb 2018
Posts: 28
Reputation: 0
Default Re: Tuning, paintjobs etc. places - disable

PHP Code:
stock IfPlayerInPrivateVehicle(playeridvehicleid){
    if(
GetPlayerState(playerid) == PLAYER_STATE_DRIVER){
        if(
PrivCar[playerid][idPrivateVehicle] == vehicleid){
            return 
true;
        } else {
            return 
false;
        }
    } 
    return 
0;

This function is good, it also works in other places. Debugs are being printed.
CherryMond is offline   Reply With Quote
Old 09/01/2019, 08:10 PM   #6
Chyakka
Big Clucker
 
Join Date: Jul 2015
Location: England
Posts: 61
Reputation: 10
Default Re: Tuning, paintjobs etc. places - disable

Is
Code:
            SendClientMessage(playerid, C_RED, "You cannot modify this car!");
being sent?
Chyakka is offline   Reply With Quote
Old 09/01/2019, 08:23 PM   #7
CherryMond
Little Clucker
 
CherryMond's Avatar
 
Join Date: Feb 2018
Posts: 28
Reputation: 0
Default Re: Tuning, paintjobs etc. places - disable

Yes.
CherryMond is offline   Reply With Quote
Old 09/01/2019, 08:36 PM   #8
Chyakka
Big Clucker
 
Join Date: Jul 2015
Location: England
Posts: 61
Reputation: 10
Default Re: Tuning, paintjobs etc. places - disable

Quote:
Originally Posted by CherryMond View Post
Yes.
So what specifically in that code is not running?
Chyakka is offline   Reply With Quote
Old 09/01/2019, 08:43 PM   #9
CherryMond
Little Clucker
 
CherryMond's Avatar
 
Join Date: Feb 2018
Posts: 28
Reputation: 0
Default Re: Tuning, paintjobs etc. places - disable

After entering the garage, the code I gave is working, but on the left a menu is displayed with the choice of tuning options. How can I disable it?
CherryMond is offline   Reply With Quote
Old 09/01/2019, 10:06 PM   #10
Chyakka
Big Clucker
 
Join Date: Jul 2015
Location: England
Posts: 61
Reputation: 10
Default Re: Tuning, paintjobs etc. places - disable

I've had a little look around and haven't found anything that could directly solve your issue but you could make use of the OnVehicleMod callback and just return 0; informing the player they cannot mod their personal vehicle.

https://wiki.sa-mp.com/wiki/OnVehicleMod
Chyakka is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Disable Pay n Spray and Tuning Shops DLR Scripting Help 0 12/11/2018 09:50 PM
How to disable car tuning places? Unri Scripting Help 8 23/10/2013 03:16 AM
Disable player teleporting inside tuning garages .v Scripting Help 0 09/10/2012 09:55 AM
paintjobs for stunt! cs_master Help Archive 1 15/05/2011 06:44 AM
Entering Places/Exiting Places Sal_Kings Help Archive 2 02/08/2009 11:01 PM


All times are GMT. The time now is 01:03 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.