08.07.2010, 13:19
First of all you dont have [MAX_PLAYERS] or [24] behind giveplayer id.
Need to look like this
Then you need
oke.. here is my code.
Need to look like this
pawn Код:
new giveplayerid[24],
new ammount,
pawn Код:
tmp = strtok(cmdtext, idx);
oke.. here is my code.
pawn Код:
dcmd_givemoney(playerid,params[])
{
new pName[24], str[128], string[128], string2[128];
GetPlayerName(playerid, pName, sizeof(pName));
format(str, sizeof(str),PlayerFile,pName);
if(!(dini_Int(str, "AdminLevel") >= 1))
{
SendClientMessage(playerid, COLOR_RED, "Admins Only!");
return 1;
}
new player, money, tmp[256];
money = strval(tmp);
if(sscanf(params,"ui",player,money))
{
SendClientMessage(playerid, COLOR_4, "USAGE: /givemoney [PlayerID] [Ammount]");
return 1;
}
if(!IsPlayerConnected(player))
{
SendClientMessage(playerid, COLOR_RED, "Invalid Player ID.");
return 1;
}
else {
new name[24];
GetPlayerName(player, name, sizeof(name));
GivePlayerMoney(player, money);
format(string,sizeof(string),"You gave %d$ to %s!",money, name);
format(string2,sizeof(string2),"Admin %s gave %d$ to you!",pName,money);
SendClientMessage(playerid,COLOR_1,string);
SendClientMessage(player,COLOR_1,string2);
}
return 1;
}