if(strcmp(cmd, "/givemoney", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /givemoney [playerid/PartOfName] [money]"); return 1; } new playa; new money; playa = ReturnUser(tmp); tmp = strtok(cmdtext, idx); money = strval(tmp); if (PlayerInfo[playerid][pAdmin] >= 1340) // u can change pAdmin]>= level u are using. { if(IsPlayerConnected(playa)) { if(playa != INVALID_PLAYER_ID) { //ConsumingMoney[playa] = 1; SafeGivePlayerMoney(playa, money); GetPlayerName(playa, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, 256, "AdmWarning: %s has admin-given %s $%d.", sendername,giveplayer,money); ABroadCast1(COLOR_YELLOW,string,1); } } } else { SendClientMessage(playerid, COLOR_GRAD1, " you are not authorized to use that command!"); } } return 1; }
if(strcmp(cmd, "/money", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /money [playerid/PartOfName] [money]"); return 1; } new playa; new money; playa = ReturnUser(tmp); tmp = strtok(cmdtext, idx); money = strval(tmp); if (PlayerInfo[playerid][pAdmin] >= 1340) // Here change pAdmin level ( owner ) if u are using some other level for it { if(IsPlayerConnected(playa)) { if(playa != INVALID_PLAYER_ID) { SafeResetPlayerMoney(playa); //ConsumingMoney[playa] = 1; SafeGivePlayerMoney(playa, money); GetPlayerName(playa, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, 256, "AdmWarning: %s has set %s money to $%d.", sendername,giveplayer,money); ABroadCast1(COLOR_YELLOW,string,1); } } } else { SendClientMessage(playerid, COLOR_GRAD1, " you are not authorized to use that command!"); } } return 1; }
Here is for /givemoney commands.
Код:
if(strcmp(cmd, "/givemoney", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /givemoney [playerid/PartOfName] [money]"); return 1; } new playa; new money; playa = ReturnUser(tmp); tmp = strtok(cmdtext, idx); money = strval(tmp); if (PlayerInfo[playerid][pAdmin] >= 1340) // u can change pAdmin]>= level u are using. { if(IsPlayerConnected(playa)) { if(playa != INVALID_PLAYER_ID) { //ConsumingMoney[playa] = 1; SafeGivePlayerMoney(playa, money); GetPlayerName(playa, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, 256, "AdmWarning: %s has admin-given %s $%d.", sendername,giveplayer,money); ABroadCast1(COLOR_YELLOW,string,1); } } } else { SendClientMessage(playerid, COLOR_GRAD1, " you are not authorized to use that command!"); } } return 1; } Here /money command, with that u can set someones money to what number u want. Код:
if(strcmp(cmd, "/money", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /money [playerid/PartOfName] [money]"); return 1; } new playa; new money; playa = ReturnUser(tmp); tmp = strtok(cmdtext, idx); money = strval(tmp); if (PlayerInfo[playerid][pAdmin] >= 1340) // Here change pAdmin level ( owner ) if u are using some other level for it { if(IsPlayerConnected(playa)) { if(playa != INVALID_PLAYER_ID) { SafeResetPlayerMoney(playa); //ConsumingMoney[playa] = 1; SafeGivePlayerMoney(playa, money); GetPlayerName(playa, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, 256, "AdmWarning: %s has set %s money to $%d.", sendername,giveplayer,money); ABroadCast1(COLOR_YELLOW,string,1); } } } else { SendClientMessage(playerid, COLOR_GRAD1, " you are not authorized to use that command!"); } } return 1; } Good luck and have fun! ![]() |
COMMAND:setmoney(playerid, params[])
{
new id, amount, name[MAX_PLAYER_NAME], string[128];
if (sscanf(params, "ud", id, amount)) SendClientMessage(playerid, -1, "Usage: /givecash <playerid/name> <amount of cash>");
if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "This player is not connected");
else
{
GetPlayerName(playerid, name, sizeof(name));
GivePlayerMoney(id, amount);
format(string, sizeof(string), "You recived $%d from Admin %s",amount, name);
SendClientMessage(id, -1, string);
}
return 1;
}