Function problem - 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: Function problem (
/showthread.php?tid=209018)
Function problem -
pantelimonfl - 09.01.2011
I made a little service and it doesn't work. It freezes me and repairs my car but it doesn't unfreeze me.
Код:
public ReparaMasina(playerid)
{
TogglePlayerControllable(playerid,1);
SCM(playerid, COLOR_LIGHTBLUE, "Masina a fost reparata. Poti pleca acum!");
return 1;
}
Код:
if(!strcmp(cmdtext, "/rc", true))
{
SCM(playerid, COLOR_LIGHTBLUE, "Masina se va repara in 30 de secunde.");
GivePlayerMoney(playerid, -500);
RepairVehicle(GetPlayerVehicleID(playerid));
TogglePlayerControllable(playerid,0);
SetTimer("ReparaMasina", 30 * 1000,0);
return 1;
}
Re: Function problem -
JaTochNietDan - 09.01.2011
That's because you're not passing a playerid to the function at all, therefore it won't work as you're intending, Pawn isn't a mindreader! You must tell it what the ID is. For example:
pawn Код:
SetTimerEx("ReparaMasina", 30 * 1000,0,"i",playerid);
Re: Function problem -
pantelimonfl - 09.01.2011
Thanks.