Help with /changegang
#1

Hi all. I have a problem.
if i have team with the number 1 and I want to transfer to team with number 0 , i write / changegang, my gang is changing to team with numer 0 but it's spawns me at team with number 1. whyy?
pawn Код:
switch(dialogid)// If you only have one dialog, then this isn't required, but it's neater for when you implement more dialogs.
        {
        case DIALOG_GANGCHANGE:// Our dialog!
            {
            switch(listitem)// Checking which listitem was selected
            {
                case 0:// The first item listed
                {
                    if(PlayerInfo[playerid] [pTeam] == 0)
                        return SendClientMessage(playerid, -1, "You cannot select the same gang.");
                    if(PlayerInfo[playerid] [pTeam] == 1)
                    {
                    SetPlayerTeam(playerid, 0);
                    PlayerInfo[playerid][pTeam] = 0;
                    SpawnPlayer(playerid);
                    SendClientMessage(playerid, -1, "Your new gang is Red Dragon Triad.");
                   
                    }
                }
                case 1: // The second item listed
                {
                    if(PlayerInfo[playerid] [pTeam] == 1)
                        return SendClientMessage(playerid, -1, "You cannot select the same gang.");
                    if(PlayerInfo[playerid] [pTeam] == 0)
                    {
                    SetPlayerTeam(playerid, 1);
                    PlayerInfo[playerid][pTeam] = 1;
                    SpawnPlayer(playerid);
                    SendClientMessage(playerid, -1, "Your new gang is The Corleone Family.");
                    }
                }
            }
            }
    }
    }
pawn Код:
public OnPlayerSpawn(playerid)
{
    if(PlayerInfo[playerid][pTeam] == 0)
    {
    SetSpawnInfo( playerid, 0,117, 2022.1766,1007.5810,10.8203,270.0330, 0, 0, 0, 0, 0, 0 );
    SetSpawnInfo( playerid, 0,118, 2022.1766,1007.5810,10.8203,270.0330, 0, 0, 0, 0, 0, 0 );
    SetSpawnInfo( playerid, 0,120, 2022.1766,1007.5810,10.8203,270.0330, 0, 0, 0, 0, 0, 0 );
    SetSpawnInfo( playerid, 0,186, 2022.1766,1007.5810,10.8203,270.0330, 0, 0, 0, 0, 0, 0 );
    SetSpawnInfo( playerid, 0,208, 2022.1766,1007.5810,10.8203,270.0330, 0, 0, 0, 0, 0, 0 );
    SetPlayerTeam(playerid, 0);
    PlayerInfo[playerid][pTeam] = 0;

    }
    if(PlayerInfo[playerid][pTeam] == 1)
    {
    SetSpawnInfo( playerid, 1, 113, 2194.3840,1676.9290,12.3672,88.4035, 0, 0, 0, 0, 0, 0 );
    SetSpawnInfo( playerid, 1, 111, 2194.3840,1676.9290,12.3672,88.4035, 0, 0, 0, 0, 0, 0 );
    SetSpawnInfo( playerid, 1, 112, 2194.3840,1676.9290,12.3672,88.4035, 0, 0, 0, 0, 0, 0 );
    SetSpawnInfo( playerid, 1, 46, 2194.3840,1676.9290,12.3672,88.4035, 0, 0, 0, 0, 0, 0 );
    SetSpawnInfo( playerid, 1, 98, 2194.3840,1676.9290,12.3672,88.4035, 0, 0, 0, 0, 0, 0 );
    SetPlayerTeam(playerid, 1);
    PlayerInfo[playerid][pTeam] = 1;
    }
   
    SetPlayerTeam(playerid, PlayerInfo[playerid] [pTeam]);


        return 1;
}
pawn Код:
public OnPlayerConnect(playerid)
{
    if(fexist(UserPath(playerid)))
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","Type your password below to login.","Login","Quit");
    }
    else
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"Registering...","Type your password below to register a new account.","Register","Quit");
    }
   
    if(PlayerInfo[playerid] [pTeam] == 0)
    {
    AddPlayerClass(118,2022.1766,1007.5810,10.8203,270.0330,0,0,0,0,0,0); // four dragons spawn
    AddPlayerClass(117,2022.1766,1007.5810,10.8203,270.0330,0,0,0,0,0,0); // four dragons spawn
    AddPlayerClass(120,2022.1766,1007.5810,10.8203,270.0330,0,0,0,0,0,0); // four dragons spawn
    AddPlayerClass(186,2022.1766,1007.5810,10.8203,270.0330,0,0,0,0,0,0); // four dragons spawn
    AddPlayerClass(208,2022.1766,1007.5810,10.8203,270.0330,0,0,0,0,0,0); // four dragons spawn
    SetPlayerTeam(playerid, 0);
    PlayerInfo[playerid][pTeam] = 0;
    }
    if(PlayerInfo[playerid] [pTeam] == 1)
    {
    AddPlayerClass(46,2194.3840,1676.9290,12.3672,88.4035,0,0,0,0,0,0); // corleone spawn
    AddPlayerClass(113,2194.3840,1676.9290,12.3672,88.4035,0,0,0,0,0,0); // corleone spawn
    AddPlayerClass(111,2194.3840,1676.9290,12.3672,88.4035,0,0,0,0,0,0); // corleone spawn
    AddPlayerClass(112,2194.3840,1676.9290,12.3672,88.4035,0,0,0,0,0,0); // corleone spawn
    AddPlayerClass(98,2194.3840,1676.9290,12.3672,88.4035,0,0,0,0,0,0); // corleone spawn
    SetPlayerTeam(playerid, 1);
    PlayerInfo[playerid][pTeam] = 1;
    }
   
   
    return 1;
}
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
        SetPlayerPos(playerid, 384.4578,-2032.0930,7.8359);
        SetPlayerCameraPos(playerid, 388.3684,-2032.2048,8.8203);
        SetPlayerCameraLookAt(playerid, 376.3958,-2031.5933,7.8301);
        SetTimerEx("SkipSpawn",1,0,"i",playerid);//It's required to have atleast 1 millisecond
        if(PlayerInfo[playerid] [pTeam] == 0)
    {
    AddPlayerClass(118,2022.1766,1007.5810,10.8203,270.0330,0,0,0,0,0,0); // four dragons spawn
    AddPlayerClass(117,2022.1766,1007.5810,10.8203,270.0330,0,0,0,0,0,0); // four dragons spawn
    AddPlayerClass(120,2022.1766,1007.5810,10.8203,270.0330,0,0,0,0,0,0); // four dragons spawn
    AddPlayerClass(186,2022.1766,1007.5810,10.8203,270.0330,0,0,0,0,0,0); // four dragons spawn
    AddPlayerClass(208,2022.1766,1007.5810,10.8203,270.0330,0,0,0,0,0,0); // four dragons spawn
    }
        if(PlayerInfo[playerid] [pTeam] == 1)
    {
        AddPlayerClass(46,2194.3840,1676.9290,12.3672,88.4035,0,0,0,0,0,0); // corleone spawn
        AddPlayerClass(113,2194.3840,1676.9290,12.3672,88.4035,0,0,0,0,0,0); // corleone spawn
        AddPlayerClass(111,2194.3840,1676.9290,12.3672,88.4035,0,0,0,0,0,0); // corleone spawn
        AddPlayerClass(112,2194.3840,1676.9290,12.3672,88.4035,0,0,0,0,0,0); // corleone spawn
        AddPlayerClass(98,2194.3840,1676.9290,12.3672,88.4035,0,0,0,0,0,0); // corleone spawn

    }

        return 1;
}
Reply
#2

UP PLS. i hate this bug.
Reply
#3

God dammit. This bug it doesn't make sense. I didn't get errors when compile
Someone have an ideea about this bug?
Reply
#4

First of all AddPlayerClass should be on GameModeInit.And now let me check the code again..
Reply
#5

And yeah , you need to make random spawn and then spawn player.Cause your setting SpawnInfo too many times.

pawn Код:
switch(dialogid)// If you only have one dialog, then this isn't required, but it's neater for when you implement more dialogs.
{
    case DIALOG_GANGCHANGE:// Our dialog!
    {
        switch(listitem)// Checking which listitem was selected
        {
            case 0:// The first item listed
            {
                if(PlayerInfo[playerid] [pTeam] == 0) return SendClientMessage(playerid, -1, "You cannot select the same gang.");
                SetPlayerTeam(playerid, 0);
                PlayerInfo[playerid][pTeam] = 0;
                //SetSpawnInfo()....
                SpawnPlayer(playerid);
                SendClientMessage(playerid, -1, "Your new gang is Red Dragon Triad.");
            }
            case 1: // The second item listed
            {
                if(PlayerInfo[playerid] [pTeam] == 1) return SendClientMessage(playerid, -1, "You cannot select the same gang.");
                SetPlayerTeam(playerid, 1);
                PlayerInfo[playerid][pTeam] = 1;
                //SetSpawnInfo().....
                SpawnPlayer(playerid);
                SendClientMessage(playerid, -1, "Your new gang is The Corleone Family.");
            }
        }
    }
}
Reply
#6

Yeah. Thx a lot. it works but how i make a random skin select? i mean...everytime i have the same skin
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)