SA-MP Forums Archive
Back to scripting, errors -_- - 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: Back to scripting, errors -_- (/showthread.php?tid=316886)



Back to scripting, errors -_- - grantism - 09.02.2012

pawn Код:
new targetid,type,string[128];
    if(sscanf(params, "ui", targetid, type)) return SendClientMessage(playerid, COLOR_GRAD2, "USAGE: {FFFFFF}/givemoney [playerid] [amount]");
    if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_GREY, "* This player is not in server..");
    if(type < 0 || type > 99999999) return SendClientMessage(playerid, COLOR_GREY, "* Cannot go under 0 or above 99999999.");
    if(PlayerInfo[playerid][pAdmin] < 10) return SendClientMessage(playerid, COLOR_GRAD1, "You are not ADMIN!");

    GivePlayerCash(targetid, type);
    format(string, sizeof(string),"AdmCmd: %s give player %s %d SAK", RPName( playerid ), RPName( targetid ), type);
    SendAdminMessage(COLOR_YELLOW,string);
    return 1;
Always shows * This player is not in server.. could some one pull the target id part, apart and explain to me whats going on?


Re: Back to scripting, errors -_- - dowster - 09.02.2012

Your version of sscanf is the most up to date, verified working version right?


Re: Back to scripting, errors -_- - grantism - 09.02.2012

I just put the new ones in there and now it just does /givemoney [playerid] [amount]


Re: Back to scripting, errors -_- - dowster - 09.02.2012

Try making the others "else if"


Re: Back to scripting, errors -_- - grantism - 09.02.2012

Quote:
Originally Posted by dowster
Посмотреть сообщение
Try making the others "else if"
pawn Код:
new targetid,type,string[128];
    if(sscanf(params, "ui", targetid, type)) return SendClientMessage(playerid, COLOR_GRAD2, "USAGE: {FFFFFF}/givemoney [playerid] [amount]");
    else if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_GREY, "* This player is not in server..");
    else if(type < 0 || type > 99999999) return SendClientMessage(playerid, COLOR_GREY, "* Cannot go under 0 or above 99999999.");
    else if(PlayerInfo[playerid][pAdmin] < 10) return SendClientMessage(playerid, COLOR_GRAD1, "You are not ADMIN!");
    else {
    GivePlayerCash(targetid, type);
    format(string, sizeof(string),"AdmCmd: %s give player %s %d SAK", RPName( playerid ), RPName( targetid ), type);
    SendAdminMessage(COLOR_YELLOW,string);
    return 1;
    }
Thanks mate, thats my new code Works +1 rep


Re: Back to scripting, errors -_- - dowster - 09.02.2012

No problem