CMD:osetcash(playerid,params[])
{
new string[124],string2[128], output[128];
if(!(PlayerInfo[playerid][pAdmin] >= 4)) return SCM(playerid, COLOR_LIGHTRED,"You are not authorized to use this command");
format(string,sizeof(string),"Users/%s.ini",params,output);
if(fexist(string))
{
new INI:File = INI_Open(string);
INI_SetTag(File,"data");
INI_WriteInt(File,"Cash", PlayerInfo[playerid][pCash]);
INI_Close(File);
format(string2, sizeof(string2), "{FFFF33}[Admin-Warning]{FF0000}: {FFFFFF}%s has Offline give cash to %s.", GetPlayerNameEx(playerid), params,output);
AdminBroadCast(COLOR_LIGHTRED, string2);
}
else SendClientMessage(playerid,COLOR_YELLOW,"{FF0000}..::{FF6347}[Database]:Account not found{FF0000}::..");
return 1;
}
CMD:osetcash(playerid,params[])
{
new name[100], amount;
if(sscanf(params,"s[100]d", name, amount)) return SendClientMessage(playerid, 0xFF0000FF,"Syntax: /osetcash [name][amount]");
new string[128];
format(string,sizeof(string),"Users/%s.ini",name);
if(fexist(name))
{
new INI:File = INI_Open(string);
INI_SetTag(File,"data");
INI_WriteInt(File,"Cash", amount);
INI_Close(File);
}
else { SendClientMessage(playerid,COLOR_YELLOW,"{FF0000}..::{FF6347}[Database]:Account not found{FF0000}::.."); }
return 1;
}
Firstly.
Use sscanf (for better parameters and usage). pawn Код:
|
CMD:osetcash(playerid,params[])
{
new name[100], amount;
if(PlayerInfo[playerid][pAdmin] >= 4)
if(sscanf(params,"s[100]d", name, amount)) return SendClientMessage(playerid, 0xFF0000FF,"Syntax: /osetcash [name][amount]");
new string[128];
format(string,sizeof(string),"Users/%s.ini",name);
if(fexist(name))
{
new INI:File = INI_Open(string);
INI_SetTag(File,"data");
INI_WriteInt(File,"Cash", amount);
INI_Close(File);
format(string, sizeof(string), "{FFFF33}[Admin-Warning]{FF0000}: {FFFFFF}%s has Offline give cash to %s.", GetPlayerNameEx(playerid), params,amount);
AdminBroadCast(COLOR_LIGHTRED, string);
}
else { SendClientMessage(playerid,COLOR_YELLOW,"{FF0000}..::{FF6347}[Database]:Account not found{FF0000}::.."); }
return 1;
}
CMD:osetcash(playerid,params[])
{
new name[100], amount;
if(PlayerInfo[playerid][pAdmin] >= 4)
if(sscanf(params,"s[100]d", name, amount)) return SendClientMessage(playerid, 0xFF0000FF,"Syntax: /osetcash [name][amount]");
new string[128];
format(string,sizeof(string),"Users/%s.ini",params);
if(fexist(string))
{
new INI:File = INI_Open(string);
INI_SetTag(File,"data");
INI_WriteInt(File,"Cash", amount);
INI_Close(File);
format(string, sizeof(string), "{FFFF33}[Admin-Warning]{FF0000}: {FFFFFF}%s has Offline give cash to %s.", GetPlayerNameEx(playerid), params,amount);
AdminBroadCast(COLOR_LIGHTRED, string);
}
else { SendClientMessage(playerid,COLOR_YELLOW,"{FF0000}..::{FF6347}[Database]:Account not found{FF0000}::.."); }
return 1;
}
format(string,sizeof(string),"Users/%s.ini",name);
CMD:osetcash(playerid,params[])
{
if(!(PlayerInfo[playerid][pAdmin] >= 4)) return SCM(playerid, COLOR_LIGHTRED,"You are not authorized to use this command");
new
_name[ 24 ],
_cash
;
if(sscanf(params, "s[24]d", _name, _cash)) return SCM(playerid, COLOR_LIGHTRED,"Usage: /osetcash <Name> <Cash>");
new
string[ 32 ]
;
format(string,sizeof(string),"Users/%s.ini",_name);
if(fexist(string))
{
new INI:File = INI_Open(string);
INI_SetTag(File,"data");
INI_WriteInt(File,"Cash", _cash);
INI_Close(File);
// I don't really understand that message
}
else SendClientMessage(playerid,COLOR_YELLOW,"{FF0000}..::{FF6347}[Database]:Account not found{FF0000}::..");
return 1;
}
This should work.
pawn Код:
|