01.01.2013, 14:51
Hello everyone, and happy new year.
I have this robplayer command which works at the moment.
The command itself does work, however can someone tell me how to make it so if there is no ID inserted and if the player only inserted "/rob" it will rob the nearest players to him?
Ty.
I have this robplayer command which works at the moment.
pawn Код:
CMD:robplayer(playerid, params[])
{
new otherplayer;
if(sscanf(params, "u", otherplayer)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /rob [ID/NAME]");
if(!IsPlayerConnected(otherplayer)) return SendClientMessage(playerid, COLOR_RED, "That Player Is Not Connected!");
if(otherplayer == playerid) return SendClientMessage(playerid, COLOR_RED, "You Can't Rob Yourself!");
if(GetDistanceBetweenPlayers(playerid,otherplayer) > 5) return SendClientMessage(playerid, COLOR_RED, "You Are Too Far Away!");
format(gstring, sizeof(gstring), "You Have Been Robbed By %s!", GetName(playerid));
SendClientMessage(otherplayer, COLOR_RED, gstring);
format(gstring, sizeof(gstring), "You Have Robbed %s!", GetName(otherplayer));
SendClientMessage(playerid, COLOR_BLUE, gstring);
new cash = GetPlayerMoney(otherplayer);
new Float:steal = cash * 0.05;
GivePlayerMoney(playerid, floatround(steal));
GivePlayerMoney(otherplayer, -floatround(steal));
return 1;
}
Ty.