26.05.2016, 13:09
The cmd works but it doesn't give me the level i set so maybe you guys know whats wrong here, thanks in advance!
PHP код:
CMD:setstat(playerid, params[])
{
new type[128],targetid,amount,string[128],name[30],filestring[79];
if(sscanf(params, "s[30]s[128]i", name, type, amount))
{
SendClientMessage(playerid, COLOR_GREY, "USAGE: /setstat [Firstname_Lastname] [stat code] [amount]");
SendClientMessage(playerid, COLOR_GREY, "| Level, |");
}
else
{
if(PlayerInfo[playerid][pAdmin] >= 2)
{
if(strcmp(type, "level", true) == 0)
{
if(IsPlayerConnected(targetid)) PlayerInfo[targetid][pLevel] = amount, SetPlayerScore(PlayerInfo[targetid][pLevel]);
else
{
format(filestring, sizeof(filestring), "Users/%s.ini", name);
if(fexist(filestring))
{
new INI:File = INI_Open(filestring);
INI_SetTag(File, "Account Info");
INI_WriteInt(File, "Level", amount);
INI_Close(File);
}
else
{
SendErrorMessage(playerid, "The player you selected doesn't exist.");
return 1;
}
}
format(string, sizeof(string),"You have setted %s's %s to %d",name,type,amount);
SendClientMessage(playerid, COLOR_GREY, string);
}
}
}
return 1;
}