Timer 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)
+--- Thread: Timer Help (
/showthread.php?tid=537803)
Timer Help -
weedxd - 17.09.2014
So basicly this is almost finished dropcar cmd but.. The thing is that as you might see there is timer which should set 20 mins between each /dropcar. But it doesen't ;/ So i wanted to ask what is the problem. ( I am not haveing any errors)
PHP код:
CMD:dropcar(playerid, params[])
{
new string[128];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
else if(dropping[playerid] == false)
{
format(string, sizeof(string), "You need to wait {FF6347}%d{33CCFF} more seconds before doing dropcar again.", DropTime[playerid]);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
if(GetPlayerVehicleID(playerid) != 0)
{
DisablePlayerCheckpoint(playerid);
SetPlayerCheckpoint(playerid, 2505.8506, -2629.0144, 13.2944, 5);
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Deliver car to the Los Santos Docks!");
dropping[playerid] = true;
}
return 1;
}
PHP код:
public OnPlayerEnterCheckpoint(playerid)
{
if(dropping[playerid] == true)
{
DisablePlayerCheckpoint(playerid);
new vehicleid = GetPlayerVehicleID(playerid);
new string[128], playerb, amount;
amount = random (100);
format(string, sizeof(string), "*You've earned {FF6347}$%d{33CCFF} from dropping a car!", amount);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
GiveDodMoney(playerb, amount);
SetVehicleToRespawn(vehicleid);
dropping[playerid] = true;
DropTime[playerid] = 60*20;
SetTimerEx("DropcarTime", 1000, false, "i", playerid);
}
Re: Timer Help -
weedxd - 18.09.2014
Guys Plss i need help to fix the timer ;/
dropping and DropTimer are the things on which you need to look at.
Re: Timer Help -
ManGoe - 18.09.2014
What errors you got list them
Re: Timer Help -
biker122 - 18.09.2014
Show your DropcarTime function
Re: Timer Help -
weedxd - 18.09.2014
Quote:
Originally Posted by ManGoe
What errors you got list them
|
I told before that there are no errors.
Quote:
Originally Posted by biker122
Show your DropcarTime function
|
On Defines "new DropTime[MAX_PLAYERS]
On Variables "DropTime[playerid] = 0;
This fixed the problem so the time is now counting.
PHP код:
forward DropcarTime(playerid);
public DropcarTime(playerid)
{
DropTime[playerid] --;
if(DropTime[playerid] < 0)
{
DropTime[playerid] = 0;
}
if(DropTime[playerid] > 0)
{
SetTimerEx("DropcarTime", 1000, false, "i", playerid);
}
return 1;
}