help with a timer
#1

well, i build a command that start your work as a pizza boy, now the job is to go checkpoint and by that you'll get money, i do a timer that freeze you on each checkpoint you go on, and the unfreeze in the timer works only for id 0, please help me, it's the command :


Quote:

if(strcmp(cmdtext, "/pwork", true) == 0)
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 44
{
if(PlayerInfo[playerid][pJob] == 20)
{
if(PWork[playerid] == 0)
{
SetPlayerCheckpoint(playerid, 1849.4888,-1917.8407,15.0228, 3.0);
CP[playerid] = 2332;
PWork[playerid] = 1;
}
else if(PWork[playerid] == 1)
{
SendClientMessage(playerid, COLOR_YELLOW, "You are already in a work");
}
}
else
{
SendClientMessage(playerid, COLOR_YELLOW, "You are not a Pizza boy");
}
}
else
{
SendClientMessage(playerid, COLOR_YELLOW, "You are not in the Pizza bike");
}
return 1;
}

and the timer :

Код:
	else if(CP[playerid] == 2332) // Pizza CP 1
	{
	    DisablePlayerCheckpoint(playerid);
 		SetPlayerCheckpoint(playerid, 2147.5068,-1367.4108,25.6418, 3.0);
	    CP[playerid] = 2333;
		PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]+money;
	    GivePlayerMoney(playerid, money);
	    SetTimer("PCP", 6000, false, "i", playerid);
		TogglePlayerControllable(playerid, 0);
		PlayerFrozen[playerid] = 1;
		SendClientMessage(playerid, COLOR_YELLOW, "Wait 6 seconds while you giving the stack !");
		SendClientMessage(playerid, COLOR_YELLOW, "Good, now drive to the next checkpoint.");
	}
	else if(CP[playerid] == 2333) // Pizza CP 2
	{
	    DisablePlayerCheckpoint(playerid);
 		SetPlayerCheckpoint(playerid, 2571.0601,-1090.4257,66.6734, 3.0);
	    CP[playerid] = 2334;
		PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]+money;
	    GivePlayerMoney(playerid, money);
	    SetTimer("PCP", 6000, false, "i", playerid);
		TogglePlayerControllable(playerid, 0);
		PlayerFrozen[playerid] = 1;
		SendClientMessage(playerid, COLOR_YELLOW, "Wait 6 seconds while you giving the stack !");
		SendClientMessage(playerid, COLOR_YELLOW, "Good, now drive to the next checkpoint.");
	}
	else if(CP[playerid] == 2334) // Pizza CP 3
	{
	    DisablePlayerCheckpoint(playerid);
 		SetPlayerCheckpoint(playerid, 1905.8390,-1117.2526,25.6641, 3.0);
	    CP[playerid] = 2335;
		PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]+money;
	    GivePlayerMoney(playerid, money);
	    SetTimer("PCP", 6000, false, "i", playerid);
		TogglePlayerControllable(playerid, 0);
		PlayerFrozen[playerid] = 1;
		SendClientMessage(playerid, COLOR_YELLOW, "Wait 6 seconds while you giving the stack !");
		SendClientMessage(playerid, COLOR_YELLOW, "Good, now drive to the next checkpoint.");
	}
	else if(CP[playerid] == 2335) // Pizza CP 4
	{
	    DisablePlayerCheckpoint(playerid);
 		SetPlayerCheckpoint(playerid, 1151.6740,-1068.5717,28.5509, 3.0);
	    CP[playerid] = 2336;
		PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]+money;
	    GivePlayerMoney(playerid, money);
	    SetTimer("PCP", 6000, false, "i", playerid);
		TogglePlayerControllable(playerid, 0);
		PlayerFrozen[playerid] = 1;
		SendClientMessage(playerid, COLOR_YELLOW, "Wait 6 seconds while you giving the stack !");
		SendClientMessage(playerid, COLOR_YELLOW, "Good, now drive to the next checkpoint.");
	}
	else if(CP[playerid] == 2336) // Pizza CP 5
	{
	    DisablePlayerCheckpoint(playerid);
 		SetPlayerCheckpoint(playerid, 852.4227,-1419.6780,13.3432, 3.0);
	    CP[playerid] = 2337;
		PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]+money;
	    GivePlayerMoney(playerid, money);
	    SetTimer("PCP", 6000, false, "i", playerid);
		TogglePlayerControllable(playerid, 0);
		PlayerFrozen[playerid] = 1;
		SendClientMessage(playerid, COLOR_YELLOW, "Wait 6 seconds while you giving the stack !");
		SendClientMessage(playerid, COLOR_YELLOW, "Good, now drive to the next checkpoint.");
	}
	else if(CP[playerid] == 2337) // Pizza CP 6
	{
	    DisablePlayerCheckpoint(playerid);
 		SetPlayerCheckpoint(playerid, 695.8505,-1645.9476,3.4811, 3.0);
	    CP[playerid] = 2338;
		PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]+money;
	    GivePlayerMoney(playerid, money);
	    SetTimer("PCP", 6000, false, "i", playerid);
		TogglePlayerControllable(playerid, 0);
		PlayerFrozen[playerid] = 1;
		SendClientMessage(playerid, COLOR_YELLOW, "Wait 6 seconds while you giving the stack !");
		SendClientMessage(playerid, COLOR_YELLOW, "Good, now drive to the next checkpoint.");
	}
	else if(CP[playerid] == 2338) // Pizza CP 7
	{
	    DisablePlayerCheckpoint(playerid);
 		SetPlayerCheckpoint(playerid, 316.0054,-1771.3463,4.6873, 3.0);
	    CP[playerid] = 2339;
		PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]+money;
	    GivePlayerMoney(playerid, money);
	    SetTimer("PCP", 6000, false, "i", playerid);
		TogglePlayerControllable(playerid, 0);
		PlayerFrozen[playerid] = 1;
		SendClientMessage(playerid, COLOR_YELLOW, "Wait 6 seconds while you giving the stack !");
		SendClientMessage(playerid, COLOR_YELLOW, "Good, now drive to the next checkpoint.");
	}
	else if(CP[playerid] == 2339) // Pizza CP 8
	{
		PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]+money;
	    GivePlayerMoney(playerid, money);
	    SetTimer("PCP", 6000, false, "i", playerid);
		TogglePlayerControllable(playerid, 0);
		PlayerFrozen[playerid] = 1;
	    DisablePlayerCheckpoint(playerid);
	    SendClientMessage(playerid, COLOR_YELLOW, "You have done your work !");
	    PWork[playerid] = 0;
	}
and there is the timer :
Код:
forward PCP(playerid);
public PCP(playerid)
{
	PlayerFrozen[playerid] = 0;
	TogglePlayerControllable(playerid, 1);
	return 1;
}
Reply
#2

OMFG... put the code inside [pawn] PUT YOUR CODE HERE [/pawn ] then somebody will help you..
Reply
#3

edited.
Reply
#4

You gotta use SetTimerEx:

pawn Код:
SetTimerEx("PCP", 6000, false, "i", playerid);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)