[HELP]/robbar command
#1

I've got two questions:

1.) How can I make it so you can't spam a /robbar command?
2.) How can I show the amount of money robbed from a store?

So far, I've made a working /robbar command, here's the script:

Код:
CMD:robbar(playerid, params[])
{
	#pragma unused params
	if (gTeam[playerid] == TEAM_CIVI)
	{
	    if (GetPlayerInterior(playerid) == 11 || IsPlayerInRangeOfPoint(playerid, 2, 496.8070, -76.0364, 998.7578))
	    {
	        new pName[MAX_PLAYER_NAME], str[128];
	        GetPlayerName(playerid, pName, sizeof(pName));
	        format(str, sizeof(str), "|_ROBBERY_|: %s has just robbed a bar!", pName);
	        SendClientMessageToAll(COLOR_GREEN, str);
	        GivePlayerMoney(playerid, random(400000));
	        SetTimer("Unrobbable",6000,1);
	    }
	}
}

forward Unrobbable();
public Unrobbable()
{
	new
			x = 6000;
	while(x > 6000)
	{
	    x++;
	}
	return 0;
}
NOTE: This is kind of like an extra bonus thing you could help me with. Whenever I input the command whilst in the checkpoint, I get the amount of money, yet I also get SERVER: Unknown Command.
Reply
#2

1) Use a timer and variable
2) Use format and show how much money is robbed (you can use random, for example, to rob random money)
Reply
#3

pawn Код:
GivePlayerMoney(playerid, rand =random(400000));
Ever tried compiling that? XD

pawn Код:
rand = random(400000);
GivePlayerMoney(playerid,rand);
Reply
#4

Thanks, everyone. But I've still got one last error, it's not showing the exact amount when you rob it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)