Cmd help - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Cmd help (
/showthread.php?tid=181169)
Cmd help -
FrankC - 04.10.2010
Why wont this code work?
when i type the command /cancelcar
it only
"TogglePlayerControllable(playerid, 1);" in a few seconds
then it goes back to
"TogglePlayerControllable(playerid, 0);" i want it to stop toggleplayerconstrol..
pawn Код:
if (strcmp(cmd, "/cancelcar", true) ==0)
{
TogglePlayerControllable(playerid, 1);
RemovePlayerFromVehicle(playerid);
return 1;
}
Re: Cmd help -
Rachael - 04.10.2010
0 ( false ) means the player is frozen
1 ( true ) means the player is not frozen
Re: Cmd help -
FrankC - 04.10.2010
Quote:
Originally Posted by Rachael
0 ( false ) means the player is frozen
1 ( true ) means the player is not frozen
|
Yes it should work then.. but i prob, found the problem i added a timer when you enter the car
only after X seconds it freeze
pawn Код:
forward Control(playerid);
pawn Код:
public Control(playerid)
{
TogglePlayerControllable(playerid, 0);
return 1;
}
pawn Код:
if(strmatch(VehicleSystem[IsBuyableCar[vehicleid]][Owner],"Unbought"))
{
format(string,sizeof(string),"[ » ] Vehicle ID: %d / Name: %s / Price: %d$ !",VehicleSystem[IsBuyableCar[vehicleid]][CarID],VehicleSystem[IsBuyableCar[vehicleid]][Name],VehicleSystem[IsBuyableCar[vehicleid]][Price]);
SendClientMessage(playerid,COLOR_GREY,string);
SetTimerEx("Control",3000,1,"i",playerid);
}
think there is a problem with that.. but cant see what
and i tryed add a
"return 1;" didnt work..
Re: Cmd help -
DevilG - 04.10.2010
Quote:
Originally Posted by FrankC
Why wont this code work?
when i type the command /cancelcar
it only "TogglePlayerControllable(playerid, 1);" in a few seconds
then it goes back to "TogglePlayerControllable(playerid, 0);" i want it to stop toggleplayerconstrol..
pawn Код:
if (strcmp(cmd, "/cancelcar", true) ==0) { TogglePlayerControllable(playerid, 1); RemovePlayerFromVehicle(playerid); return 1; }
|
Have you tried-...
pawn Код:
if (strcmp(cmd, "/cancelcar", true) ==0)
{
RemovePlayerFromVehicle(playerid);
TogglePlayerControllable(playerid, 1);
return 1;
}
Don't know if it'll work though, but it will make the player controllable after he's been removed from the vehicle.
Re: Cmd help -
FrankC - 05.10.2010
Quote:
Originally Posted by DevilG
Have you tried-...
pawn Код:
if (strcmp(cmd, "/cancelcar", true) ==0) { RemovePlayerFromVehicle(playerid); TogglePlayerControllable(playerid, 1); return 1; }
Don't know if it'll work though, but it will make the player controllable after he's been removed from the vehicle. ![Cheesy](images/smilies/biggrin.png)
|
Nah.. didnt work
Re: Cmd help -
LarzI - 05.10.2010
You never kill the timer, so it will continue freezing each time it get's called.
To fix, easily change '1' to '0':
pawn Код:
SetTimerEx("Control",3000,0,"i",playerid);
Re: Cmd help -
FrankC - 05.10.2010
Quote:
Originally Posted by LarzI
You never kill the timer, so it will continue freezing each time it get's called.
To fix, easily change '1' to '0':
pawn Код:
SetTimerEx("Control",3000,0,"i",playerid);
|
Thank you