10.04.2011, 19:35
How to create a cmd like /givemoney which gives you money... But i want to create a command which
when i type /paricna id 3000 to deprive -3000 to that player ?
when i type /paricna id 3000 to deprive -3000 to that player ?
pawn Код:
if(strcmp(cmd, "/paricna", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "Koriscenje: /paricna [ID Igraca/Dio Imena] [novac]");
return 1;
}
new playa;
new money;
playa = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
money = strval(tmp);
if (PlayerInfo[playerid][pAdmin] >= 3)
{
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
SafeGivePlayerMoney(playa, -money);
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, 256, "[ADMIN] %s je dao %s-u novac $%d.", sendername,giveplayer,money);
ABroadCast(COLOR_YELLOW,string,1);
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " niste ovlasteni da koristite tu komandu!");
}
}
return 1;
}