04.01.2010, 23:17
Quote:
Originally Posted by Zimon95
Hello I need a /rob command only if the player is in a 24/7 and when a player robs all the players have to wait 1 hour to remake a rob. Thank you!
|
pawn Код:
dcmd_rob(playerid, params[])
{
new userid, string[128], targetsname[MAX_PLAYER_NAME], money, muggersname[MAX_PLAYER_NAME];
if (sscanf(params, "u", userid)) SendClientMessage(playerid, COLOR_WHITE, "SYNTAX - /mask [playerid]");
else
{
if(IsPlayerConnected(userid))
{
GetPlayerMoney(userid);
if(GetDistanceBetweenPlayers(playerid, userid) > 3)
{
SendClientMessage(playerid, COLOR_WHITE, "You're not close enough.");
return 1;
}
if(money < 0)
{
SendClientMessage(playerid, COLOR_WHITE, "That player doesn't have enough money to rob from. (0)");
return 1;
}
GetPlayerName(playerid, muggersname, sizeof(muggersname));
GetPlayerName(userid, targetsname, sizeof(targetsname));
format(string, sizeof(string), "You have robbed $%d, from %s.", money, targetsname);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "You have been 'mugged'! You have lost $%d, %s stole it.", money, muggersname);
SendClientMessage(playerid, COLOR_WHITE, string);
GivePlayerMoney(playerid, money);
}
}
return 1;