07.06.2009, 21:04
Hi
in my GM i have this command /agivemoney to give money to some player without leaving any money from anyone.
How i can modify this to a command /asetmoney to set player money 
Exmple: if the player has 100.000 ----> /asetplayermoney 50.000 and player will have 50.000
in my GM i have this command /agivemoney to give money to some player without leaving any money from anyone.
Код:
if(strcmp(cmd, "/agivemoney", true) == 0) {
tmp = strtok(cmdtext, idx);
giveplayerid = strval(tmp);
GetPlayerName(playerid, sendername, sizeof(sendername));
PlayerInfo[playerid][pAdmin] = dini_Int(udb_encode(sendername), "level");
if(logged[playerid] == 0) {
SendClientMessage(playerid, COLOR_BRIGHTRED, "You must be logged in to use this command!");
return 1;
}
if(PlayerInfo[playerid][pAdmin] < 1) {
SendClientMessage(playerid, COLOR_BRIGHTRED, "You do not have permission to use that command!");
return 1;
}
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /agivemoney [playerid] [amount]");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /agivemoney [playerid] [amount]");
return 1;
}
moneys[playerid] = strval(tmp);
if (IsPlayerConnected(giveplayerid)) {
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
GetPlayerMoney(playerid);
GivePlayerMoney(giveplayerid, moneys[playerid]);
format(string, sizeof(string), "You have given $%d to %s (id: %d).",moneys[playerid],giveplayer,giveplayerid);
SendClientMessage(playerid, COLOR_ORANGE, string);
format(string, sizeof(string), "You have been given $%d from Admin/Moderator %s (id: %d).", moneys[playerid], sendername, playerid);
SendClientMessage(giveplayerid, COLOR_ORANGE, string);
}
else {
format(string, sizeof(string), "%d is not an active player.", giveplayerid);
SendClientMessage(playerid, COLOR_BRIGHTRED, string);
}
return 1;
}

Exmple: if the player has 100.000 ----> /asetplayermoney 50.000 and player will have 50.000

