Originally Posted by DeathOnaStick
Quote:
Originally Posted by mprofitt
pawn Код:
dcmd_givecash(playerid, params[]) { if (sscanf(params, "ud", giveplayerid, amount)) return SendClientMessage(playerid, 0xFF9900AA, "Usage: /givecash [playerid/partname] [amount]"); new string[256], playername[MAX_PLAYER_NAME], giveplayerid, amount; if (giveplayerid == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFF9900AA, "Player Not Found"); else if (amount > GetPlayerMoney(playerid)) SendClientMessage(playerid, 0xFF9900AA, "You Don't Have Enough Money!"); else if (giveplayerid == playerid) SendClientMessage(playerid,0xFF9900AA,"You Can't Give Money To Yourself!"); else { GetPlayerName(playerid, playername, MAX_PLAYER_NAME); GivePlayerMoney(giveplayerid, amount); GameTextForPlayer(giveplayerid,"~g~Money Recived",3000,5); format(string, sizeof(string), "You Recived $%d From Player %s(%d)",amount,playername,giveplayerid); SendClientMessage(giveplayerid,0x33CCFFAA,string); GivePlayerMoney(playerid, 0 - amount); GameTextForPlayer(playerid,"~y~Money Sent",3000,5); format(string, sizeof(string), "You Have Sent $%d To Player %s(%d)",amount,playername,playerid); SendClientMessage(playerid,0x33CCFFAA,string); } return 1; }
|
Fail. Use this:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[]) { dcmd(givecash, 8, cmdtext); return 0; }
dcmd_givecash(playerid, params[]) { new string[256]; new playername[MAX_PLAYER_NAME]; GetPlayerName(playerid, playername, MAX_PLAYER_NAME); new giveplayerid, amount; if (sscanf(params, "ud", giveplayerid, amount))return SendClientMessage(playerid, 0xFF9900AA, "Usage: /givecash [playerid/partname] [amount]"); else if (giveplayerid == INVALID_PLAYER_ID)return SendClientMessage(playerid, 0xFF9900AA, "Player Not Found"); else if (amount > GetPlayerMoney(playerid))return SendClientMessage(playerid, 0xFF9900AA, "You Don't Have Enough Money!"); else if (giveplayerid == playerid)return SendClientMessage(playerid,0xFF9900AA,"You Can't Give Money To Yourself!"); else { GivePlayerMoney(giveplayerid, amount); GameTextForPlayer(giveplayerid,"~g~Money Recived",3000,5); format(string, sizeof(string), "You Recived $%d From Player %s(%d)",amount,playername,giveplayerid); SendClientMessage(giveplayerid,0x33CCFFAA,string); GivePlayerMoney(playerid, 0 - amount); GameTextForPlayer(playerid,"~y~Money Sent",3000,5); format(string, sizeof(string), "You Have Sent $%d To Player %s(%d)",amount,playername,playerid); SendClientMessage(playerid,0x33CCFFAA,string); } return 1; }
You just needed to use "return SendClientMessage" instead of "SendClientMessage", so it won't go further down the code. That's all.
Cheers.
|