Spawn player problems.
#2

pawn Код:
#include <a_samp>

new MapChange;
forward StartedNewRound();
forward NewMapTimer(playerid);


new Float:SpawnLVA[][]=
{
        {1651.1795, 1543.3081, 14.6334, 0.0000},
        {1623.3718, 1536.6872, 14.6334, 0.0000},
        {1635.2894, 1581.7091, 14.6334, 270.0000},
        {1591.5916, 1624.0827, 14.6334, 180.0000},
        {1701.4981, 1673.0771, 14.6334, 180.0000},
        {1701.4981, 1577.7366, 14.6334, 90.0000},
        {1718.7124, 1634.6761, 14.6334, 0.0000}
};

new Float:SpawnWESTLV[][] =
{
        {1059.4184, 1081.0885,10.1808 ,270.0000 },
        {1092.5228, 1107.5720,10.1808 ,180.0000 },
        {1122.9788, 1069.1709,10.1808 ,90.0000 },
        {1085.9019, 1040.0391,10.1808 ,0.0000 },
        {1091.1986, 1073.1435,10.8359 ,0.0000 },
        {1122.9788, 1100.9511,10.1808 ,180.0000 },
        {1064.7151, 1103.5995,10.1808 ,180.0000 }
};

public OnPlayerSpawn(playerid)
{

    GivePlayerWeapon(playerid,24,300); //DEAGLE
    GivePlayerWeapon(playerid,25,300); //SHOTGUN
    GivePlayerWeapon(playerid,34,300); //SNIPER
    SetPlayerArmour(playerid, 100);
    TextDrawShowForPlayer(playerid, FINAL);
    SetPlayerToMap(playerid);
    return 1;
}




SetPlayerToMap(playerid)
{
    switch (MapChange)
    {                       // you must have a case for the mapchange to get the list going
            case 0:                                   // MapChange1 this is the part for MapChange = 0; Which basically starts of the first MapChangein the list
            {
                new rand = random(sizeof(SpawnLVA));
                SetPlayerPos(playerid, SpawnLVA[rand][0],SpawnLVA[rand][1],SpawnLVA[rand][2]);        // XYZ Co-rds of the first map
                SetPlayerFacingAngle(playerid,SpawnLVA[rand][3]);   // Facing Angle of the first map
                TogglePlayerControllable(playerid, 1);
            }
            case 1:                                   // MapChange2 same settings on top
            {
                new rand = random(sizeof(SpawnWESTLV));
                SetPlayerPos(playerid, SpawnWESTLV[rand][0],SpawnWESTLV[rand][1],SpawnWESTLV[rand][2]);        // XYZ Co-rds of the first map
                SetPlayerFacingAngle(playerid,SpawnWESTLV[rand][3]);
                TogglePlayerControllable(playerid, 1);

                MapChange =-1;
            }
            return 1;
    }
}




public NewMapTimer(playerid)                      // The function we forwarded on the beginning of the tutorial
{
    MapChange += 1;                            // this makes it to go to the second MapChange++ part basically does it
    roundstats[playerid][rKills] = 0;
    roundstats[playerid][rDeaths] = 0;


    GameTextForPlayer(playerid, "~r~Switching maps, wait...", 4000, 6);
    SetTimer("StartedNewRound",8000,false);       // Starts a new timer for the MapChangechange 4 seconds this basically starts the new MapChangeand always must be in false
    return 1;
}

forward StartedNewRound();
public StartedNewRound()                          // The callback we forwarded in the beginning of this tutorial
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {        // this loops everyone in the server also you can use foreach include for this part
        SpawnPlayer(i);                      // Re Spawns everyone in the server which then gets OnPlayerSpawn Callback called
    }
    return 1;
}
Try it.
Reply


Messages In This Thread
Spawn player problems. - by Lofti - 26.07.2015, 23:46
Re: Spawn player problems. - by TwinkiDaBoss - 27.07.2015, 00:25
Re: Spawn player problems. - by Jefff - 27.07.2015, 01:12
Re: Spawn player problems. - by Lofti - 27.07.2015, 19:06
AW: Spawn player problems. - by Mencent - 27.07.2015, 19:11
Re: AW: Spawn player problems. - by Lofti - 27.07.2015, 19:18
AW: Spawn player problems. - by Mencent - 27.07.2015, 19:21

Forum Jump:


Users browsing this thread: 3 Guest(s)