Robshop timer
#1

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

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;
}
Reply
#2

Are you sure that this callback PlayerOneSecondVariables is set as 1,000 mileseconds timer under OnGameModeInit?

pawn Код:
public OnGameModeInit()
{
    SetTimer("PlayerOneSecondVariables", 1000, true);
    return true;;
}
Reply
#3

Edit not fixed
Reply
#4

Sorry for double post but it isnt the issue i get the same problem
Reply
#5

Quote:
Originally Posted by DarkLored
Посмотреть сообщение
Sorry for double post but it isnt the issue i get the same problem
I'm sorry, I copied and pasted the callback and I noticed a mistake

pawn Код:
public OnGameModeInit()
{
    SetTimer("PlayerOneSecondVariables", 1000, true);//removed ()
    return true;;
}
Reply
#6

Thanks it worked +1 REPED
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)