SA-MP Forums Archive
How to.... - 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: How to.... (/showthread.php?tid=368956)



How to.... - Vizi - 15.08.2012

How can i make /acceptinvite?When LEADER /invite me to his organisation and i need to write /acceptinvite to accept or /declineinvite to decline.? HElp

Here is the /invite if you need

pawn Код:
//----------------------------------[INVITE]------------------------------------------------
    if(strcmp(cmd, "/invite", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, WHITE, ""COL_ORANGE"KORISTETE:{FFFFFF} /invite [playerid/PartOfName]");
                return 1;
            }
            new para1;
            new ftext[20];
            para1 = ReturnUser(tmp);
            if (PlayerInfo[playerid][pLeader] >= 1)
            {
                if(IsPlayerConnected(para1))
                {
                    if(para1 != INVALID_PLAYER_ID)
                    {
                            if(PlayerInfo[playerid][pLeader] == 1) { PlayerInfo[para1][pTeam] = 2; gTeam[para1] = 2; ftext = "PD"; ChosenSkin[para1] = 282; SetPlayerSkin(para1, 282); }
                            else if(PlayerInfo[playerid][pLeader] == 2) { PlayerInfo[para1][pTeam] = 2; gTeam[para1] = 2; ftext = "MBI"; ChosenSkin[para1] = 66; SetPlayerSkin(para1, 66); }
                            else if(PlayerInfo[playerid][pLeader] == 3) { PlayerInfo[para1][pTeam] = 2; gTeam[para1] = 2; ftext = "ARM"; ChosenSkin[para1] = 285; SetPlayerSkin(para1, 285); }
                            else if(PlayerInfo[playerid][pLeader] == 4) { PlayerInfo[para1][pTeam] = 1; gTeam[para1] = 1; ftext = "MD"; ChosenSkin[para1] = 276; SetPlayerSkin(para1, 276); }
                            else if(PlayerInfo[playerid][pLeader] == 5) { PlayerInfo[para1][pTeam] = 5; gTeam[para1] = 5; ftext = "Yakuza"; ChosenSkin[para1] = 121; SetPlayerSkin(para1, 121); }
                            else if(PlayerInfo[playerid][pLeader] == 6) { PlayerInfo[para1][pTeam] = 5; gTeam[para1] = 5; ftext = "LCN"; ChosenSkin[para1] = 112; SetPlayerSkin(para1, 112); }
                            else if(PlayerInfo[playerid][pLeader] == 7) { PlayerInfo[para1][pTeam] = 10; gTeam[para1] = 12; ftext = "Vlada"; ChosenSkin[para1] = 164; SetPlayerSkin(para1, 164); }
                            else if(PlayerInfo[playerid][pLeader] == 8) { PlayerInfo[para1][pTeam] = 10; gTeam[para1] = 12; ftext = "Hitman Agency"; ChosenSkin[para1] = 20; SetPlayerSkin(para1, 20); }
                            else if(PlayerInfo[playerid][pLeader] == 9) { PlayerInfo[para1][pTeam] = 12; gTeam[para1] = 12; ftext = "LSN"; ChosenSkin[para1] = 1; SetPlayerSkin(para1, 1); }
                            else if(PlayerInfo[playerid][pLeader] == 10) { PlayerInfo[para1][pTeam] = 12; gTeam[para1] = 12; ftext = "Taxi Cab Company"; ChosenSkin[para1] = 210; SetPlayerSkin(para1, 210); }
                            else if(PlayerInfo[playerid][pLeader] == 15) { PlayerInfo[para1][pTeam] = 5; gTeam[para1] = 5; ftext = "GrooveStreet"; ChosenSkin[para1] = 105; SetPlayerSkin(para1, 105); }
                            else if(PlayerInfo[playerid][pLeader] == 12) { PlayerInfo[para1][pTeam] = 5; gTeam[para1] = 5; ftext = "L.Santos Gang"; ChosenSkin[para1] = 175; SetPlayerSkin(para1, 175); }
                            else if(PlayerInfo[playerid][pLeader] == 11) { PlayerInfo[para1][pTeam] = 12; gTeam[para1] = 12; ftext = "School Instructors"; ChosenSkin[para1] = 59; SetPlayerSkin(para1, 59); }
                            else { return 1; }
                            GetPlayerName(para1, giveplayer, sizeof(giveplayer));
                            GetPlayerName(playerid, sendername, sizeof(sendername));
                            PlayerInfo[para1][pMember] = PlayerInfo[playerid][pLeader];
                            PlayerInfo[para1][pRank] = 1;
                            printf("AdmCmd: %s go povika %s da bide negov clen vo %s.", sendername, giveplayer, ftext);
                            format(string, sizeof(string), "   Pokaneti ste vo %s, ve povika vas Liderot %s", ftext, sendername);
                            SendClientMessage(para1, COLOR_WHITE, string);
                            format(string, sizeof(string), "   Go pokanivte %s da se pridruzi %s.", giveplayer,ftext);
                            SendClientMessage(playerid, COLOR_WHITE, string);
                    }
                }//not connected
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   Ne ste ovlasteni za taa komanda,samo lideri!");
            }
        }
        return 1;
    }



Re: How to.... - SaYrOn - 15.08.2012

I see you are using godfather script. There's a command /accept, look for it and add new parameter invite or something. Then you need a new global variable, something like:

Код:
new InviteOffer[MAX_PLAYERS];
Then you need to add this in /invite:

Код:
InviteOffer[playerid] = PlayerInfo[playerid][pLeader]
And finally on /accept just set player faction to InviteOffer.


Re: How to.... - Vizi - 15.08.2012

im not usig godfather