22.11.2013, 20:21
Hello i made a rob shop command in a different type but i cant get how to make the timer for it to work
i want the code to be the same way that it is now but i want it to work if someone can help me i will +1 Rep him
the problem is that the timer dosent decrease and the game text is disappring
here is my code
i want the code to be the same way that it is now but i want it to work if someone can help me i will +1 Rep him
the problem is that the timer dosent decrease and the game text is disappring
here is my code
pawn Код:
CMD:robshop(playerid,params[])
{
new string[180];
if(IsPlayerInDynamicCP(playerid,Checkpoint[2]))
{
RobbingCityHall[playerid] = 25;
CityHallWasRobbedRecently[playerid] = 320;
IncreaseScore(playerid, 1);
IncreaseWantedLevel(playerid,4);
format(string,sizeof(string),"~w~Robbing CityHall.~n~~r~Finish Robbery in: %d seconds.~n~~b~Police are on the way.",RobbingCityHall[playerid]);
GameTextForPlayer(playerid, string, 3000, 3);
format(string,sizeof(string),"[POLICE RADIO] Suspect %s(%d) has begun to rob City Hall! Get To City Hall and arrest the suspect.",GetName(playerid),playerid);
SendClientMessageToAllCops(string);
format(string,sizeof(string),"[ROBBERY] %s(%d) has begun a robbery at City Hall ..",GetName(playerid),playerid);
SendClientMessageToAll(COLOR_RED,string);
}
return 1;
}
pawn Код:
public PlayerOneSecondVariables()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
new string[128];
new pname;
if(RobbingCityHall[i] > 1)
{
RobbingCityHall[i] --;
format(string,sizeof(string),"~w~Robbing CityHall.~n~~r~Finish Robbery in: %d seconds.~n~~b~Police are on the way.",RobbingCityHall[i]);
GameTextForPlayer(i, string, 3000, 3);
}
if(RobbingCityHall[i] == 1)
{
new mrand =random(20000);
RobbingCityHall[i] =0;
format(string,sizeof(string),"~w~City Hall Robbery Complete.~n~~r~You Robbed total of $%d from City Hall.~n~~b~Watch out for police.",mrand,RobbingCityHall[i]);
GameTextForPlayer(i, string, 3000, 3);
GivePlayerMoney(i,mrand);
format(string,sizeof(string),"[ROBBERY] %s(%d) has robbed a total of $%d from City Hall! Someone is going to be killed ..",pname,i,mrand);
SendClientMessageToAll(COLOR_RED,string);
}
}
}
return 1;
}