Help with random skins from onplayerspawn
#1

Hi there. I have these codes on ondialogresponse.
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( playerid, 0,186, 2022.1766,1007.5810,10.8203,270.0330, 0, 0, 0, 0, 0, 0 );
                SpawnPlayer(playerid);
                SendClientMessage(playerid, -1, "Your new gang is {0xAA3333AA}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( playerid, 1, 112, 2194.3840,1676.9290,12.3672,88.4035, 0, 0, 0, 0, 0, 0 );
                SpawnPlayer(playerid);
                SendClientMessage(playerid, -1, "Your new gang is {COL_DARK}The Corleone Family.");
            }
        }
    }
}
}
you can see, if player is changing gang, he only can get a skin. what should I do to set my skins random from onplayerspawn
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 );
                    AddPlayerClass(118,2022.1766,1007.5810,10.8203,270.0330,0,0,0,0,0,0); // four dragons spawn
   
    }
        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 );
                    AddPlayerClass(46,2194.3840,1676.9290,12.3672,88.4035,0,0,0,0,0,0); // corleone spawn
    }
        return 1;
}
Help me fast pls.
Reply
#2

In the top add this
pawn Код:
new YourPeds[54][1] = {
{293},
{295},
{296},
{297},
{61},
{255},
{253} // You can add more skins.
};
pawn Код:
new randomskin;
if(PlayerInfo[playerid] [pTeam] == 1) { randomskin = random(sizeof(YourPeds)); } // Here if the player have Team 1 it will give him random skins from YourPeds.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)