Team Random spawn
#1

i was making my basic DM GM but accidentally unexpected problem has came
i try to make a Team Random spawn but it didn't work it spawn me in Las Venturas the main spawn
i try this code onplayerspawn but it didn't work:

pawn Код:
new Float:RandomSpawnGrove[][] =
{
    {2522.9924,-1669.3948,14.9668,109.5784},
    {2513.0620,-1679.6508,13.4860,17.4809},
    {2498.1260,-1685.7640,13.4440,327.3705},
    {2493.2993,-1650.3931,13.5173,207.7227}
};


public OnPlayerSpawn(playerid)
{
    switch(gTeam[playerid])
    {
        case TEAM_GROVE:
        {
            new RandomG = random(sizeof(RandomSpawnGrove));
            SetPlayerPos(playerid, RandomSpawnGrove[RandomG][0], RandomSpawnGrove[RandomG][1], RandomSpawnGrove[RandomG][2]);
            SetPlayerFacingAngle(playerid, RandomSpawnGrove[RandomG][3]);
        }
    }
    return 1;
}
i did something wrong? i will give you one rep+
Reply
#2

pawn Код:
new Float:RandomSpawnGrove[4][4] = // 4 lines, 4 co-ords within each line.
{
    {2522.9924,-1669.3948,14.9668,109.5784},
    {2513.0620,-1679.6508,13.4860,17.4809},
    {2498.1260,-1685.7640,13.4440,327.3705},
    {2493.2993,-1650.3931,13.5173,207.7227}
};
Reply
#3

it didn't work it still makes me spawn at Las Venturas + i need help the case 11 (which is CJ skin)
code doesn't respond in OnPlayerrequestclass

pawn Код:
case 11:
        {
            GameTextForPlayer(playerid, "~g~Grove Street", 300, 3 );
            SetPlayerTeam(playerid, TEAM_GROVE);
            SetPlayerTeamColor(playerid);
            SetPlayerPos(playerid, 2495.0044,-1673.7354,13.3359);
            SetPlayerFacingAngle(playerid, 0.4392);
            SetPlayerCameraPos(playerid, 2489.7310,-1667.4996,13.3438);
            SetPlayerCameraLookAt(playerid, 2495.0044,-1673.7354,13.3359);
        }
i actually count the skins correct

pawn Код:
/* Police & Agent Team */
   
       //Agents
    AddPlayerClass(165, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    AddPlayerClass(166, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
   
      //Police
    AddPlayerClass(280, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    AddPlayerClass(281, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    AddPlayerClass(282, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    //Total 5 Members in one Team
   
    /* Terrorist Team */

    AddPlayerClass(101, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    AddPlayerClass(176, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    AddPlayerClass(177, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    AddPlayerClass(179, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    AddPlayerClass(217, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    //Total 5 Members in one Team
   
    /* Grove Street Team */
   
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    AddPlayerClass(105, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    AddPlayerClass(106, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    AddPlayerClass(107, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    AddPlayerClass(270, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    //Total 5 Members in one Team
Reply
#4

CJ skin is case 10 as it starts from 0 not 1.

Edit: As foir the other code still spawning you at the default position. I would change your switch to simple if statements to see if it works that way.

pawn Код:
public OnPlayerSpawn(playerid)
{
    if(gTeam[playerid] == TEAM_GROVE)
    {
        new RandomG = random(sizeof(RandomSpawnGrove));
        SetPlayerPos(playerid, RandomSpawnGrove[RandomG][0], RandomSpawnGrove[RandomG][1], RandomSpawnGrove[RandomG][2]);
            SetPlayerFacingAngle(playerid, RandomSpawnGrove[RandomG][3]);
    }
    return 1;
}
Reply
#5

thanks Infamous +rep for helping that skin. i fixed the random spawn by myself i change the code ^
Reply
#6

Ok pal no problem.
Reply


Forum Jump:


Users browsing this thread: