CMD:pay(playerid, params[])
{
new otherid, cash;
if (sscanf(params, "dd", otherid, cash)) SendClientMessage(playerid, 0xFF0000AA, "Usage: /pay [ID] [Cash]");
else
{
if(GetPlayerMoney(playerid) > cash) SendClientMessage(playerid, COLOR_RED, "You don't have that much!");
else if(!IsPlayerConnected(otherid)) SendClientMessage(playerid, COLOR_RED, "That PlayerID is not connected!");
else if(otherid == playerid) SendClientMessage(playerid, COLOR_RED, "It is pointless to pay yourself..");
else
{
GivePlayerMoney(playerid, -cash);
GivePlayerMoney(otherid, cash);
}
}
return 1;
}
new Float:x,Float:y,Float:z; GetPlayerPos(otherid,x,y,z); if(IsPlayerInRangeOf(playerid, 5.0, x,y,z) != 1) return SendClientMessage(playerid, COLOR_WHITE, "You are not close enought to that player!");
use
Код:
new Float:x,Float:y,Float:z; GetPlayerPos(otherid,x,y,z); if(IsPlayerInRangeOf(playerid, 5.0, x,y,z) != 1) return SendClientMessage(playerid, COLOR_WHITE, "You are not close enought to that player!"); Hope i helped |
CMD:pay(playerid, params[])
{
new otherid, cash;
if (sscanf(params, "dd", otherid, cash)) SendClientMessage(playerid, 0xFF0000AA, "Usage: /pay [ID] [Cash]");
else
{
if(GetPlayerMoney(playerid) < cash) SendClientMessage(playerid, COLOR_RED, "You don't have that much!");
if(!IsPlayerConnected(otherid)) SendClientMessage(playerid, COLOR_RED, "That PlayerID is not connected!");
if(otherid == playerid) SendClientMessage(playerid, COLOR_RED, "It is pointless to pay yourself..");
else
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(otherid, X, Y, Z);
if(IsPlayerInRangeOfPoint(playerid, 5.0, X, Y, Z);
{
GivePlayerMoney(playerid, -cash);
GivePlayerMoney(otherid, cash);
}
else return SendClientMessage(playerid, -1, "You are not close enough to the specified player!");
}
}
return 1;
}
pawn Код:
|
CMD:pay(playerid, params[]) { new otherid, cash; if (sscanf(params, "dd", otherid, cash)) SendClientMessage(playerid, 0xFF0000AA, "Usage: /pay [ID] [Cash]"); else { if(GetPlayerMoney(playerid) < cash) SendClientMessage(playerid, COLOR_RED, "You don't have that much!"); if(!IsPlayerConnected(otherid)) SendClientMessage(playerid, COLOR_RED, "That PlayerID is not connected!"); if(otherid == playerid) SendClientMessage(playerid, COLOR_RED, "It is pointless to pay yourself.."); else { new Float:X, Float:Y, Float:Z; GetPlayerPos(otherid, X, Y, Z); if(!IsPlayerInRangeOfPoint(playerid, 5.0, X, Y, Z)) return SendClientMessage(playerid, -1, "You are not close enough to the specified player!"); GivePlayerMoney(playerid, -cash); GivePlayerMoney(otherid, cash); } } return 1; }