SA-MP Forums Archive
Rwarns - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Rwarns (/showthread.php?tid=440415)



Rwarns - Face9000 - 29.05.2013

I just made this command to reset the warnings to an offline player but seems don't work.

The warnings are still there (in /stats and in player file):

pawn Код:
CMD:rwarns(playerid,params[])
{
    if(pInfo[playerid][Logged] == 0) return SCM(playerid,0x0080C0FF,"Please login before using this command.");
    if(pInfo[playerid][Admin] >= 5)
    {
    new id;
    new name[128];
    new aName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, aName, sizeof(aName));
    if(sscanf(params, "s[128]",name)) return SCM(playerid,-1,"{F70505}Usage: {FFFFFF}/rwarns <account name>");
    if(GetPVarInt(id,"CmdTime")>GetTickCount())return SCM(playerid,0xFF0000FF,"Please wait before using this command again.");
    new string[250];
    new echos[250];
    new Year, Month, Day, Hour, Minute, Second;
    getdate(Year, Month, Day);
    gettime(Hour, Minute, Second);

    new stringo[90];
    new filestring[128];
    format(filestring, sizeof(filestring), "/Users/%s.ini", name);
    if(!fexist(filestring)) return SCM(playerid,red, "Player account not found.");
    else
    {
        dini_IntSet(filestring, "Warn", 0);
        format(stringo, sizeof(stringo),"Success! You have resetted %s's warnings.", name);
        SCM(playerid, red,stringo);
    }
    format(string, sizeof(string), "** Admin %s (%d) resetted %s's warnings - %02d/%02d/%02d - %02d:%02d:%02d", aName,id,name,Day,Month,Year,Hour,Minute,Second);
    format(echos, sizeof(echos), "1,4** Admin %s (%d) resetted %s's warnings - %02d/%02d/%02d - %02d:%02d:%02d", aName,id,name,Day,Month,Year,Hour,Minute,Second);
    SendMessageToAdmins(red,string);
    IRC_Say(gGroupID, IRC_CHANNEL, echos);
    IRC_Say(gGroupID, IRC_ACHANNEL, echos);
    SetPVarInt(id,"CmdTime",GetTickCount()+2000);
    RWarnsLog(string);
    }
    return 1;
}
the "Users" folder is in scriptfiles, obv.


Re: Rwarns - GiamPy. - 29.05.2013

May you please output the "Warn" value of the file you just edited as a debug printf?


AW: Rwarns - HurtLocker - 29.05.2013

I remember some weeks ago where you made a post asking for help and you used y_ini. Now I see you use dini. There is an incompatibility between dini and y_ini because dini reads this: warns=0 while y_ini reads this: warn = 0.


Re: Rwarns - Pottus - 29.05.2013

Just wanted to point out one thing, there is no such word as "resetted" it is simply "reset".

@Hurtlocker that is a good possibility, I don't see much of a problem in this code besides how ugly it looks to me.


Re: AW: Rwarns - Face9000 - 30.05.2013

Quote:
Originally Posted by HurtLocker
Посмотреть сообщение
I remember some weeks ago where you made a post asking for help and you used y_ini. Now I see you use dini. There is an incompatibility between dini and y_ini because dini reads this: warns=0 while y_ini reads this: warn = 0.
I switched globally to dini.


Re: Rwarns - Face9000 - 01.06.2013

Bump, still need help with this.