callback help (public robbtimer) (bugging)
#1

At my callback, its bugged.

Explaination: When i /robbank, then the wanted level goes to me. then when the robtimer is "DONE" The wanted level goes to ID 0. And the suspect name changed to ID 0 Names. For example your ID 0, Then someone rob the bank, Then when the bank robberry timer is done then it will say "
Код:
format(string, sizeof(string), "[BREAKING NEWS] The suspect %s has successfully rob the money bank", GetPlayerNameEx(playerid));
It Goes to this:
Код:
format(string, sizeof(string), "[BREAKING NEWS] The suspect ID 0 NAME has successfully rob the money bank", GetPlayerNameEx(playerid));
I hope you understand it.

QUESTION: How do i fix it?

Here is my callback codes:

Код:
public robtimer(playerid)
{
		if(RobberBusted[playerid] == 1)
		{
		    SendClientMessageToAll(COLOR_GREEN, "[BREAKING NEWS]: Bank Robberry Failed! Suspect has been BUSTED!");
		    SendClientMessage(playerid, COLOR_YELLOW, "You were busted by the POLICE, Bank Robbery Fail!");
		    RobberBusted[playerid] = 0;
		    pBankRobbing[playerid] = 0;
		    return 1;
		}
		else if(RobberBusted[playerid] == 2)
		{
		    SendClientMessageToAll(COLOR_RED, "[BREAKING NEWS]: Bank Robberry failed! Suspect has been eliminated ((Leaving/Timeout at server))");
		    RobberBusted[playerid] = 0;
		    pBankRobbing[playerid] = 0;
			return 1;
		}
		else
		{
			new string[128];//We are defining a new string for the formatted message that we are displaying later on.
		    new cash = random(2000000);
		    GivePlayerCash(playerid, cash);
	        /*
	    With the fuction above 'new cash = random(200000);
	        GivePlayerMoney(playerid, cash);' we give the player
	    a random amount of money from $0 - $200,000
	    */
	    //Here below we use the string we defined above to format the message itself and display it to the player.
	        format(string, sizeof(string), "You have successfully robbed $%d from the bank!", cash);
	        SendClientMessage(playerid, COLOR_GREEN, string);
	        format(string, sizeof(string), "[BREAKING NEWS] The suspect %s has successfully rob the money bank", GetPlayerNameEx(playerid));
	        SendClientMessageToAll(COLOR_REALRED, string);

	        ++PlayerInfo[playerid][pCrimes];
	  		++PlayerInfo[playerid][pCrimes];
			++PlayerInfo[playerid][pCrimes];

			SetPlayerWantedLevel(playerid, ++PlayerInfo[playerid][pWantedLevel]);
			SetPlayerWantedLevel(playerid, ++PlayerInfo[playerid][pWantedLevel]);
			SetPlayerWantedLevel(playerid, ++PlayerInfo[playerid][pWantedLevel]);


	        ++PlayerInfo[playerid][pCrimes];
	  		++PlayerInfo[playerid][pCrimes];
			++PlayerInfo[playerid][pCrimes];

			SetPlayerWantedLevel(playerid, ++PlayerInfo[playerid][pWantedLevel]);
			SetPlayerWantedLevel(playerid, ++PlayerInfo[playerid][pWantedLevel]);
			SetPlayerWantedLevel(playerid, ++PlayerInfo[playerid][pWantedLevel]);
		}
		return 1;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)