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!