SA-MP Forums Archive
Scripting Help - 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: Scripting Help (/showthread.php?tid=285947)



Scripting Help - Vincent_Johnson - 26.09.2011

Ok, basically what i need is to make this command do more. Like for example if i demote, hire or fire someone, i want it to say in orange letters like: "Vincent_Johnson has promoted Drew_Anders to a level 1 Admin." "Vincent_Johnson has demoted Drew Anders to a level 1 Admin." or "Vincent_Johnson has removed Drew_Anders's Admin."

I'm having trouble making it do that exactly, like, i don't know what i'm supposed to do, if anyone could gimme some guidance, or simply tell me how to do it, that'd be so great.


pawn Код:
if(strcmp(cmd,"/makeadmin", true) == 0)
        {
            if(IsPlayerConnected(playerid))
            {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /makeadmin [playerid/PartOfName] [level(1-3)]");
                return 1;
            }
            if(PlayerInfo[playerid][pDisabled] == 1)
            {
                SendClientMessage(playerid, TEAM_CYAN_COLOR, "   You can't use this command ! You're Disabled !");
                return 1;
            }
            new para1;
            new level;
            para1 = ReturnUser(tmp);
            tmp = strtok(cmdtext, idx);
            level = strval(tmp);
            if (PlayerInfo[playerid][pAdmin] >= 9999)
            {
                if(IsPlayerConnected(para1))
                {
                    if(para1 != INVALID_PLAYER_ID)
                    {
                        GetPlayerName(para1, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        PlayerInfo[para1][pAdmin] = level;
                        printf("AdmCmd: %s has promoted %s to a level %d admin.", sendername, giveplayer, level);
                        format(string, sizeof(string), "   You have been promoted to a level %d admin by %s.", level, sendername);
                        SendClientMessage(para1, COLOR_LIGHTBLUE, string);
                        format(string, sizeof(string), "   You have promoted %s to a level %d admin.", giveplayer,level);
                        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                        format(string, sizeof(string), " %s has promoted %s to a level %d admin.", sendername, giveplayer, level);
                        ABroadCast(COLOR_SACBLUE,string, 2);
                        OnPlayerSave(playerid);
                        OnPlayerSave(para1);
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   You are not authorized to use that command !");
            }
        }
        return 1;
    }



Re: Scripting Help - Yamoo - 26.09.2011

Uh, just set his admin level to 0 then it's over lol.


Re: Scripting Help - Jack_Leslie - 26.09.2011

Have like:

pawn Код:
if(PlayerInfo[para1][pAdmin] < level)
{
    format(string, sizeof(string), "   You have been demoted to a level %d admin by %s.", level, sendername);
}
if(PlayerInfo[para1][pAdmin] > level)
{
    format(string, sizeof(string), "   You have been promoted to a level %d admin by %s.", level, sendername);
}
if(PlayerInfo[para1][pAdmin] == 0)
{
    format(string, sizeof(string), "   Your admin rights have been removed by %s.", level, sendername);
}
//Send the string here
If you get my drift. I don't know if I done the maths right? But you should know what I mean...


Re: Scripting Help - Ensconce - 26.09.2011

Quote:
Originally Posted by Jack_Leslie
Посмотреть сообщение
Have like:

pawn Код:
if(PlayerInfo[para1][pAdmin] < level)
{
    format(string, sizeof(string), "   You have been demoted to a level %d admin by %s.", level, sendername);
}
if(PlayerInfo[para1][pAdmin] > level)
{
    format(string, sizeof(string), "   You have been promoted to a level %d admin by %s.", level, sendername);
}
if(PlayerInfo[para1][pAdmin] == 0)
{
    format(string, sizeof(string), "   Your admin rights have been removed by %s.", level, sendername);
}
//Send the string here
If you get my drift. I don't know if I done the maths right? But you should know what I mean...
Yeah your 'maths' if we can even call it that is a bit off. The players current level is stored in the variable pAdmin, therefore if pAdmin is greater than level, it means the admin is being demoted.


Re: Scripting Help - Vincent_Johnson - 28.09.2011

Quote:
Originally Posted by Ensconce
Посмотреть сообщение
Yeah your 'maths' if we can even call it that is a bit off. The players current level is stored in the variable pAdmin, therefore if pAdmin is greater than level, it means the admin is being demoted.
Well would you happen to know how to do it?