if(strcmp(cmd, "/charge", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /charge [Playerid/PartOfName] [money] [reason]");
return 1;
}
new playa;
new money;
playa = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
money = strvalEx(tmp);
if(money < 1)
{
SendClientMessage(playerid, COLOR_GREY, "The price shouldn't be less than 1$");
return 1;
}
if (PlayerInfo[playerid][pAdmin] >= 2)
{
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /charge [Playerid/PartOfName] [money] [reason]");
return 1;
}
if (!GetPVarInt(giveplayerid, "gPlayerLogged"))
{
SendClientMessage(playerid, COLOR_RED, "The player is not connected.");
return 1;
}
new year, month,day;
getdate(year, month, day);
format(string, sizeof(string), "AdmCmd: %s has punished %s with %d$, reason: %s (%d-%d-%d)", sendername, giveplayer, money, (result) ,month, day, year);
ChargeLog(string);
format(string, sizeof(string), "AdmCmd: %s has punished %s with %d$, reason: %s", sendername, giveplayer, money, (result));
SendClientMessageToAll(COLOR_LIGHTRED, string);
SafeGivePlayerMoney(playa, -money);
return 1;
}
}
}
else
SendClientMessage(playerid, COLOR_RED, "The player is not connected!");
}
return 1;
}
new x, ChargedMoney; x = money; ChargedMoney = x - (x/100 * 10); GivePlayerMoney(playerid, ChargedMoney);
Код HTML:
new x, ChargedMoney; x = money; ChargedMoney = x - (x/100 * 10); GivePlayerMoney(playerid, ChargedMoney); |