SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 10/03/2011, 10:07 PM   #1
austin070
Huge Clucker
 
austin070's Avatar
 
Join Date: Aug 2010
Posts: 227
Reputation: 11
Default ZCMD Help

Hey guys. I made an adminlevel command and it doesn't seem to work. I get no errors or anything.

pawn Code:
CMD:adminlevel(playerid, params[])
{
    if(sscanf(params, "ui", str)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /adminlevel [playerid] [level 1-5]");
    if(GetAdminLevel(playerid)>=5) {
        new giveplayerid;
        giveplayerid = ReturnUser(params[1]);
        new givename[24];
        GetPlayerName(giveplayerid, givename, sizeof(givename));
        new sendername[24];
        GetPlayerName(playerid, sendername, sizeof(sendername));
        if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOR_YELLOW, "This player is not online!");
        format(str, sizeof(str), "%s has set your admin level to %i!", sendername, params[2]);
        format(str, sizeof(str), "You have set the admin level of %s to %i!", givename, strval(params[2]));
        SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, str);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
        format(str, sizeof(str), USER_FILE, givename);
        dini_IntSet(str, "AdminLevel", strval(params[2]));
    }
    return 1;
}

It just does this
pawn Code:
if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOR_YELLOW, "This player is not online!");

Anyone see a problem?
austin070 is offline  
Old 10/03/2011, 10:14 PM   #2
Hal
High-roller
 
Hal's Avatar
 
Join Date: May 2010
Location: Toronto, Canada
Posts: 1,219
Reputation: 43
Default Re: ZCMD Help

pawn Code:
CMD:adminlevel(playerid, params[])
{
    new level, giveplayerid;
    if(sscanf(params, "ii", giveplayerid, level)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /adminlevel [playerid] [level 1-5]");
    if(GetAdminLevel(playerid)>=5) {
        new givename[24];
        GetPlayerName(giveplayerid, givename, sizeof(givename));
        new sendername[24];
        GetPlayerName(playerid, sendername, sizeof(sendername));
        if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOR_YELLOW, "This player is not online!");

        format(str, sizeof(str), "%s has set your admin level to %i!", sendername, level);
        format(str, sizeof(str), "You have set the admin level of %s to %i!", givename, level);
        SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, str);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
        format(str, sizeof(str), USER_FILE, givename);
        dini_IntSet(str, "AdminLevel", level));
    }
    return 1;
}

i'm not sure if this fixed your problem, but now its using sscanf the way its meant to be used. It should fix it because now the parameters are defined and you do not have to pull the info outta them
__________________

Wanna start a project thats NOT sa-mp with me? I have a bunch of server space, PM me.
Hal is offline  
Old 10/03/2011, 10:17 PM   #3
dengli
Little Clucker
 
Join Date: Aug 2006
Posts: 36
Reputation: 0
Default Re: ZCMD Help

if(sscanf(params, "ui", str))
you should change it to
if(sscanf(params, "ui", giveplayerid,adminlevel))
dengli is offline  
Old 10/03/2011, 10:21 PM   #4
austin070
Huge Clucker
 
austin070's Avatar
 
Join Date: Aug 2010
Posts: 227
Reputation: 11
Default Re: ZCMD Help

OMG I didn't even notice that I was defining ui as str. lol. Stupid mistakes.

Thanks for the help.
austin070 is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Zcmd help Jin_Li Help Archive 1 07/02/2011 11:48 AM
zcmd help yarrum3 Help Archive 1 04/02/2011 12:15 PM
Help with using zcmd XoX Help Archive 2 15/01/2011 12:45 PM
ZCMD Help. Zh3r0 Help Archive 11 22/09/2010 07:14 PM
/me in ZCMD newarvuti Help Archive 6 11/05/2010 04:48 PM


All times are GMT. The time now is 08:21 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.