SA-MP Forums Archive
Some Problem with timers - 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: Some Problem with timers (/showthread.php?tid=456311)



Some Problem with timers - IceBilizard - 05.08.2013

Guys i have my driving license test system when player click on Practical test then player will be in the car at outside of school and start giving test and on timer i set the seconds when player giving test seconds will count but the problem is when my player sits in the car seconds works perfectly but when another player start giving test then seconds showing on my screen not on that player here is the code see what is the problem

This is for seconds
pawn Код:
forward Driving(playerid);
public Driving(playerid)
{
    new string[256];
    format(string,256,"~w~%d",de_sec);
    GameTextForPlayer(playerid, string, 3000, 6);
    de_sec = de_sec+1;
    return 1;
}
This is for when player start test
pawn Код:
if(PlayerInfo[playerid][DL]) return SendClientMessage(playerid, COLOR_GREY, "You already have a Car license.");
                if(DLicenseTest[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You have already started the Car driving license test.");
                DLicenseTest[playerid] =1;
                KCP[playerid] = 1;
                SetPlayerInterior(playerid, 0);
                SetPlayerVirtualWorld(playerid,0);
                Drcar700 = AddStaticVehicleEx(496,-2026.6243,-94.1022,34.8806,90.2311, -1, -1, -1);
                car700 = Create3DTextLabel("{FFFFFF}Driving school",COLOR_WHITE,0.0,0.0,0.0,42.0,0,0);
                Attach3DTextLabelToVehicle(car700,Drcar700,0.0,0.0,0.75);
                new lights, alarm, doors, bonnet, boot, objective;
                SetVehicleParamsEx(Drcar700, 1, lights, alarm, doors, bonnet, boot, objective);
                de_timer = SetTimer("Driving",1000,true);
                SendClientMessage(playerid, COLOR_WHITE, "Your driving test has been started!");
                SetPlayerRaceCheckpoint(playerid,0,-2004.3075,1051.4850,55.2831,-1563.7072,915.6661,6.7555,5);
                PutPlayerInVehicle(playerid, Drcar700, 0);
                PlayerInfo[playerid][DCP] = 1;
                return 1;



Re: Some Problem with timers - morocco - 05.08.2013

pawn Код:
// Change
 de_timer = SetTimer("Driving",1000,true);
// To
de_timer = SetTimerEx("Driving", 1000, true, "i", playerid);



Re: Some Problem with timers - IceBilizard - 05.08.2013

Thanks budy +rep


Re: Some Problem with timers - Konstantinos - 05.08.2013

pawn Код:
new string[256];
format(string,256,"~w~%d",de_sec);
Array of 256 for just displaying the seconds? The text is not even 8 characters.. waste.


Re: Some Problem with timers - IceBilizard - 06.08.2013

yea i fixed the string size to 8