SA-MP Forums Archive
Help me please !! REP++ - 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: Help me please !! REP++ (/showthread.php?tid=368958)



Help me please !! REP++ - Vizi - 15.08.2012

Hi. how i can make 2function on 1 command ?exemple
1 command for Admin and GameMaster(Player+)
command /on
When i am a admin and i write /on to Show "Admin BLABLA is on duty"
When i am a GameMaste to show "GameMAster blabla is on duty"
I have this but when i am a admin and write /on shows
"Admin blabla is on duty"
"GameMaster blabla is on duty"
why ?
here is the command

pawn Код:
//------------------------------------------------------------------------------
if (strcmp(cmd,"/on",true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if (PlayerInfo[playerid][pAdmin] >= 1)
            {
                    new sMsg[ 128 ];
                    GetPlayerName( playerid, sMsg, MAX_PLAYER_NAME );
                    SetPlayerColor(playerid, COLOR_GROVE);
                    SetPlayerArmour(playerid, 10000.0);
                    SetPlayerHealth(playerid, 10000.0);
                    format( sMsg, sizeof( sMsg ), "(GC)Admin %s e na dolznost.", sMsg );
                    SendClientMessageToAll(COLOR_LIGHTRED, sMsg);
                    SetPlayerAttachedObject(playerid, 3, 19065, 2, 0.120000, 0.040000, -0.003500, 0, 100, 100, 1.4, 1.4, 1.4);
                    OnDuty[playerid] = 1;
            }
            else
            {
                SendClientMessage(playerid, COLOR_RED, "{FF4040}GRESKA:{FFFFFF}Ne ste Ovlasteni za ovaa Komanda.");
                return 1;
            }
            if (PlayerInfo[playerid][pGameMaster] >= 1 || PlayerInfo[playerid][pGameMaster] <= 3)
            {
                    new sMsg[ 128 ];
                    GetPlayerName( playerid, sMsg, MAX_PLAYER_NAME );
                    SetPlayerColor(playerid, COLOR_DBLUE);
                    SetPlayerArmour(playerid, 10000.0);
                    SetPlayerHealth(playerid, 10000.0);
                    format( sMsg, sizeof( sMsg ), "(GC)GameMaster %s e na dolznost.", sMsg );
                    SendClientMessageToAll(COLOR_LIGHTRED, sMsg);
                    SetPlayerAttachedObject(playerid, 3, 19065, 2, 0.120000, 0.040000, -0.003500, 0, 100, 100, 1.4, 1.4, 1.4);
                    OnDuty[playerid] = 1;
            }
            else
            {
                SendClientMessage(playerid, COLOR_RED, "{FF4040}GRESKA:{FFFFFF}Ne ste Ovlasteni za ovaa Komanda.");
                return 1;
            }
        }
        return 1;
    }



Re: Help me please !! REP++ - [DOG]irinel1996 - 15.08.2012

I don't understand very well your problem, but give a try:
pawn Код:
if (strcmp(cmd,"/on",true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pGameMaster] >= 1 || PlayerInfo[playerid][pGameMaster] <= 3)
            {
                    new sMsg[ 128 ];
                    GetPlayerName( playerid, sMsg, MAX_PLAYER_NAME );
                    SetPlayerColor(playerid, COLOR_DBLUE);
                    SetPlayerArmour(playerid, 10000.0);
                    SetPlayerHealth(playerid, 10000.0);
                    format( sMsg, sizeof( sMsg ), "(GC)GameMaster %s e na dolznost.", sMsg );
                    SendClientMessageToAll(COLOR_LIGHTRED, sMsg);
                    SetPlayerAttachedObject(playerid, 3, 19065, 2, 0.120000, 0.040000, -0.003500, 0, 100, 100, 1.4, 1.4, 1.4);
                    OnDuty[playerid] = 1;
            }
            else if(PlayerInfo[playerid][pAdmin] >= 1)
            {
                    new sMsg[ 128 ];
                    GetPlayerName( playerid, sMsg, MAX_PLAYER_NAME );
                    SetPlayerColor(playerid, COLOR_GROVE);
                    SetPlayerArmour(playerid, 10000.0);
                    SetPlayerHealth(playerid, 10000.0);
                    format( sMsg, sizeof( sMsg ), "(GC)Admin %s e na dolznost.", sMsg );
                    SendClientMessageToAll(COLOR_LIGHTRED, sMsg);
                    SetPlayerAttachedObject(playerid, 3, 19065, 2, 0.120000, 0.040000, -0.003500, 0, 100, 100, 1.4, 1.4, 1.4);
                    OnDuty[playerid] = 1;
            }
            else
            {
                SendClientMessage(playerid, COLOR_RED, "{FF4040}GRESKA:{FFFFFF}Ne ste Ovlasteni za ovaa Komanda.");
                return 1;
            }
        }
        return 1;
    }
PD: Don't write "REP+" in the title, maybe that's the reason you don't get any answer.


Re: Help me please !! REP++ - IceMeteor - 15.08.2012

pawn Код:
if (strcmp(cmd,"/on",true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if (PlayerInfo[playerid][pAdmin] >= 1)
            {
                    new sMsg[ 128 ];
                    GetPlayerName( playerid, sMsg, MAX_PLAYER_NAME );
                    SetPlayerColor(playerid, COLOR_GROVE);
                    SetPlayerArmour(playerid, 10000.0);
                    SetPlayerHealth(playerid, 10000.0);
                    format( sMsg, sizeof( sMsg ), "(GC)Admin %s e na dolznost.", sMsg );
                    SendClientMessageToAll(COLOR_LIGHTRED, sMsg);
                    SetPlayerAttachedObject(playerid, 3, 19065, 2, 0.120000, 0.040000, -0.003500, 0, 100, 100, 1.4, 1.4, 1.4);
                    OnDuty[playerid] = 1;
            }
            else if (PlayerInfo[playerid][pGameMaster] >= 1 || PlayerInfo[playerid][pGameMaster] <= 3)
            {
                    new sMsg[ 128 ];
                    GetPlayerName( playerid, sMsg, MAX_PLAYER_NAME );
                    SetPlayerColor(playerid, COLOR_DBLUE);
                    SetPlayerArmour(playerid, 10000.0);
                    SetPlayerHealth(playerid, 10000.0);
                    format( sMsg, sizeof( sMsg ), "(GC)GameMaster %s e na dolznost.", sMsg );
                    SendClientMessageToAll(COLOR_LIGHTRED, sMsg);
                    SetPlayerAttachedObject(playerid, 3, 19065, 2, 0.120000, 0.040000, -0.003500, 0, 100, 100, 1.4, 1.4, 1.4);
                    OnDuty[playerid] = 1;
            }
            else
            {
                SendClientMessage(playerid, COLOR_RED, "{FF4040}GRESKA:{FFFFFF}Ne ste Ovlasteni za ovaa Komanda.");
                return 1;
            }
        }
        return 1;
    }



Re: Help me please !! REP++ - Vizi - 15.08.2012

aha i need to add else if right for that ?


Re: Help me please !! REP++ - Kalroz - 15.08.2012

Can you please explain your prob?


Re: Help me please !! REP++ - [DOG]irinel1996 - 15.08.2012

Quote:
Originally Posted by Vizi
Посмотреть сообщение
aha i need to add else if right for that ?
Yes.
Have to say that if you're GameMaster and Admin at the same time, in my case, my command will send the message as GameMaster. It can be change, but it isn't a problem, I think.