SA-MP Forums Archive
Command problem - 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: Command problem (/showthread.php?tid=434034)



Command problem - Face9000 - 30.04.2013

Im making an offline stats cmd for irc:

pawn Код:
IRCCMD:ostats(botid, channel[], user[], host[], params[])
{
    if(IRC_IsOp(botid,channel,user))
    {
        new stringg[64];
        new playername3[MAX_PLAYER_NAME];
        new id;
        GetPlayerName(id, playername3, sizeof(playername3));
        format(stringg, sizeof(stringg), "/Users/%s.ini", playername3);
        if(dini_Exists(stringg)) return IRC_GroupSay(gGroupID, channel,"12,1Error: Account doesnt exist!");
        new str[1500];
        new str2[1000];
        new a,b,c,d,e,f,g,h,i,l,m,n,o,p,q,r,s,t,u,v,z;
        a= dini_Int(stringg(params), "Admin");
        b= dini_Int(stringg(params), "Cash");
        c= dini_Int(stringg(params), "Vip");
        d= dini_Int(stringg(params), "Scores");
        e= dini_Int(stringg(params), "Deaths");
        f= dini_Int(stringg(params), "Nopm");
        g= dini_Int(stringg(params), "Muted");
        i= dini_Int(stringg(params), "Cookies");
        l= dini_Int(stringg(params), "Warn");
        m= dini_Int(stringg(params), "Jailed");
        n= dini_Int(stringg(params), "Logged");
        o= dini_Int(stringg(params), "AdminActions");
        p= dini_Int(stringg(params), "Rank");
        q= dini_Int(stringg(params), "TempBan");
        r= dini_Int(stringg(params), "VipTime");
        s= dini_Int(stringg(params), "KillAsUsaTeam");
        t= dini_Int(stringg(params), "KillAsGermanyTeam");
        u= dini_Int(stringg(params), "KillAsRussiaTeam");
        v= dini_Int(stringg(params), "KillAsJapanTeam");
        z= dini_Int(stringg(params), "KillAsMercTeam");
        new ip[128];
        ip = dini_Get("/Logs/playerips.txt",params);
        format(str,sizeof str,"2Offline Stats For Player %s:",params);
        IRC_Say(IRC_EchoConnection[0],channel,str);
        format(str,sizeof str,"12,0Level: %d - Cash: %d - Vip: %d - Kills: %d - Deaths: %d - Nopm: %d - Muted: %d - Cookies: %d - Warns: %d - Jailed: %d - Logged: %d - Admin Actions: %d - Rank: %d - TempBan: %d - Vip Time: %d",a,b,c,d,e,f,g,h,i,l,m,n,o,p,q,r);
        format(str2,sizeof str2,"12,0Kill As Usa Team: %d - Kill As Germany Team: %d - Kill As Russia Team: %d - Kill As Japan Team: %d - Kill As Merc Team: %d",s,t,u,v,z);
        IRC_GroupSay(gGroupID, channel,str);
        IRC_GroupSay(gGroupID, channel,str2);
        new ban;
        ban = dini_Int(udb_encode(params),"Banned");
        if(ban == 1)
        {
            IRC_Say(IRC_EchoConnection[0],channel,"12,0Account Banned: 4Yes");
        }   else IRC_Say(IRC_EchoConnection[0],channel,"12,0Account Banned: 12No");
    }
    return 1;
}
This is what i did so far, but i get this:

(12689) : error 012: invalid function call, not a valid address
(12689) : warning 215: expression has no effect
(12689) : error 001: expected token: ";", but found ")"
(12689) : error 029: invalid expression, assumed zero
(12689) : fatal error 107: too many error messages on one line

Error line:

pawn Код:
a= dini_Int(stringg(params), "Admin");



Re: Command problem - Jessyy - 01.05.2013

System files dini:
"dini_Int(filename[], key[])"
Example:
Код:
new number = dini_Int("/folder/file.ini", "Stored_value");
if(number == 1)
{
    // stuff to do
}
What you have in code:
Код:
new stringg[64];
format(stringg, sizeof(stringg), "/Users/%s.ini", playername3);
new a,...;
a = dini_Int(stringg(params), "Admin");
...
the "stringg" is a variable not a function, so you have to remove what is whit red, the parameter "params" and brackets from line
Код:
a = dini_Int(stringg, "Admin");