SA-MP Forums Archive
*** This topic title sucks, "help me" is not descriptive. - 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: *** This topic title sucks, "help me" is not descriptive. (/showthread.php?tid=390231)



*** This topic title sucks, "help me" is not descriptive. - Deaglez - 05.11.2012

pawn Код:
CMD:setlevel(playerid, params[])
{
    new id, level, string1[64];
    if(PlayerInfo[playerid][pAdmin] > 3 || IsPlayerAdmin(playerid))
    {
            if(!IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "SERVER: Player ID not connected.");
            if(sscanf(params, "ud", id, level)) return SendClientMessage(playerid, -1, "Usage: /setlevel [id] [level]");
            if(level > 5) return SendClientMessage(playerid, -1, "SERVER: Level is too high. [0/5]");
            SendClientMessage(playerid, -1, "SERVER: You have successfully set the target player to admin");
            format(string1, sizeof(string1), "You have been promoted to an admin level %s", level); // <<<<<< This is the error
            SendClientMessage(id, -1, string1);
            GameTextForPlayer(id, "~r~Promoted", 3000, 0);
            PlayerInfo[id][pAdmin] = level;
    }
    else
    {
        SendClientMessage(playerid, -1, "SERVER: You need to be a level 4 admin or a rcon admin.");
    }
    return 1;
}
When I join in game and set players level. It says:
Код:
SERVER: You have been promoted to an admin level
But i didnt say "admin level %s" << The string problem i think.

Pls help. I'll give your REP


Re: What am i Doing wrong - Alex Magaсa - 05.11.2012

hmm one question what is this
Quote:

SendClientMessage(playerid, -1
? as i know in -1 you should add the color
Also do u get any errors/warning when you compile?


Re: What am i Doing wrong - JaKe Elite - 05.11.2012

^^

-1 is color white


Re: What am i Doing wrong - Deaglez - 05.11.2012

Anyone help?


Re: What am i Doing wrong - Laure - 05.11.2012

Maybe he might have -1 defined as the color and try this one
Код:
CMD:setlevel(playerid, params[])
{
    new id, level, string1[64];
    if(PlayerInfo[playerid][pAdmin] > 3 || IsPlayerAdmin(playerid))
    {
            if(!IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "SERVER: Player ID not connected.");
            if(sscanf(params, "ud", id, level)) return SendClientMessage(playerid, -1, "Usage: /setlevel [id] [level]");
            if(level > 5) return SendClientMessage(playerid, -1, "SERVER: Level is too high. [0/5]");
            SendClientMessage(playerid, -1, "SERVER: You have successfully set the target player to admin");
            format(string1, sizeof(string1), "You have been promoted to an admin level %d", level); // You need to use %d for numbers.
            SendClientMessage(id, -1, string1);
            GameTextForPlayer(id, "~r~Promoted", 3000, 0);
            PlayerInfo[id][pAdmin] = level;
    }
    else
    {
        SendClientMessage(playerid, -1, "SERVER: You need to be a level 4 admin or a rcon admin.");
    }
    return 1;
}



Re: What am i Doing wrong - Deaglez - 05.11.2012

OMG. FUCK THANKS!

2 REPS FOR YOU!