Scanff problems.
#1

My sscanf seems to do the opposite from what i want.

Here i got 3 example cmds i made:
pawn Код:
CMD:a(playerid, params[])
{
    new string[128];
    if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_RED, "ERROR: You are not authorized use this command");
    if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /a [text]");
    format(string,sizeof(string), "%s %s: {FFFFFF}%s", ALVL(playerid), RPName(playerid), params);
    SendAdminMessage(COLOR_RED,string);
    return 1;
}
pawn Код:
CMD:makeadmin(playerid, params[])
{
    new targetid, admin, string[128];
    if(PlayerInfo[playerid][pAdmin] < 1337) return SendClientMessage(playerid, COLOR_RED, "ERROR: You are not authorized to use this command.");
    if(sscanf(params, "ud", targetid, admin)) return SendClientMessage(playerid, COLOR_WHITE,"Usage: /makeadmin [PlayerID][AdminLevel]");
    if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "ERROR: That player is not in the server");
    if(PlayerInfo[playerid][pAdmin] < PlayerInfo[targetid][pAdmin]) return SendClientMessage(playerid, COLOR_WHITE, "ERROR: You cant demote/promote a higher level admin.");
    if(PlayerInfo[playerid][pAdmin] < admin) return SendClientMessage(playerid, COLOR_WHITE,"ERROR: You can't promote yourself");
    PlayerInfo[targetid][pAdmin] = admin;
    format(string, sizeof(string), "You have been made admin level %d by %s", admin,RPName(playerid));
    SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
    format(string, sizeof(string), "You have made %s a admin level %d", RPName(targetid), admin);
    return 1;
}
pawn Код:
CMD:kick(playerid, params[])
{
    new targetid, string[128];
    if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_RED, "ERROR: You are not authorized to use this command.");
    if(sscanf(params, "us[128]", targetid, params)) return SendClientMessage(playerid, COLOR_WHITE,"Usage: /kick [PlayerID][Reason]");
    if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE,"ERROR: That player is not in the server.");
    if(PlayerInfo[playerid][pAdmin] < PlayerInfo[targetid][pAdmin]) return SendClientMessage(playerid, COLOR_WHITE, "ERROR: You can't kick a higher level admin.");
    format(string, sizeof(string), "AdmCmd: %s has kicked %s, reason: %s", RPName(playerid), RPName(targetid), params);
    SendClientMessageToAll(COLOR_TOMATO, string);
    KickWithMessage(targetid);
    return 1;
}
After typing in /kick 1 Bye! or /makeadmin 0 6 or /a hai!
Everytime i get the msg that i have set on sscanf return..
It's doing it on all my cmds that use sscanf,
Updated Sscanf, tried on linux and on windows...

Any help??
Reply


Messages In This Thread
Scanff keeps showing the return msg. - by Facerafter - 05.06.2013, 11:24
Re: Scanff problems. - by IceBilizard - 05.06.2013, 14:02

Forum Jump:


Users browsing this thread: 1 Guest(s)