Is this right? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Is this right? (
/showthread.php?tid=436467)
Is this right? -
EliteApple - 11.05.2013
While re-vamping something in my script, I wind up putting this:
pawn Код:
for(new i = 0; i < sizeof(DynamicCars); i++)
{
if(DynamicCars[i][CarType] != 1)
{
SetVehicleParamsForPlayer(i, playerid, 1, 0);
}
}
But it's not working. But I'm also not getting any errors, is it even right?
Re: Is this right? -
feartonyb - 11.05.2013
This looks fine. What do you want to make with this? To lock the car?
Re: Is this right? -
EliteApple - 11.05.2013
Unlocking it. It won't unlock. I've turned it into this:
pawn Код:
for (new carid =0; carid<MAX_VEHICLES; carid++)
{
if(DynamicCars[carid][CarType] == 1)
{
SetVehicleParamsForPlayer(carid, playerid, 0, 0);
SendClientMessage(playerid, COLOR_RED, "This works.");
}
}
I get the message three times (3 vehicles have type '1', so yeah that should be legit.) But they aren't unlocking.
Re: Is this right? -
feartonyb - 11.05.2013
You dont need for if you are unlocking just that car.
Use this
if(DynamicCars[GetPlayerVehicleID(playerid)][CarType] == 1)
{
SetVehicleParamsForPlayer(GetPlayerVehicleID(playe rid),playerid,0,1);
}
Re: Is this right? -
EliteApple - 11.05.2013
1) It's unlocking /THREE/ cars of the same TYPE.
2) The player is not in a vehicle during the time this is processed.
AW: Is this right? -
Blackazur - 11.05.2013
Yep, that should work.
Re: Is this right? -
feartonyb - 11.05.2013
Bro where do you put this code. In onplayerentervehicle on onplayerstatechange?
Re: Is this right? -
EliteApple - 11.05.2013
Inside of a command, actually.
Re: Is this right? -
feartonyb - 11.05.2013
Man put the command here.
Re: Is this right? -
EliteApple - 11.05.2013
Nevermind it. Found a way to bypass it.