03.08.2011, 22:10
Quote:
Hello,
The player registers and everything is working fine, but then say I change their money in their .ini file to 5000, it does not load it... Here is the parsefile: pawn Code:
|
SSCANF is the way to go for making this kind of command.
I will show you mine. (You can have it if you want)
pawn Code:
CMD:givecash(playerid,params[])
{
if(PlayerInfo[playerid][pAdminLevel] >=2)
{
new
id,
amount;
new Str[64];
if(sscanf(params, "ud", id, amount)) SendClientMessage(playerid,COLOR_RED,"Usage: /givecash <ID> <Amount>");
else if(id == INVALID_PLAYER_ID) SendClientMessage(playerid,COLOR_RED,"Error: Player Not Connected!");
else
{
new name[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
GetPlayerName(id, PlayerName, sizeof(PlayerName));
GivePlayerMoney(id,amount);
new str[40+MAX_PLAYER_NAME];
format(str, sizeof(str), "You have sent %d to %s(ID:%d)",amount,PlayerName,id);
SendClientMessage(playerid, COLOR_GREEN, str);
format(str, sizeof(str), "Admin:%s(ID:%d)Has gave you %d!",name,id,amount);
SendClientMessage(id, COLOR_GREEN, str);
SaveToLog("Givecash_Log.txt", Str);
}
return 1;
}
else return SendClientMessage(playerid, COLOR_RED, " You are not allowed to use this command");
}