SA-MP Forums Archive
random spawn - 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: random spawn (/showthread.php?tid=475193)



random spawn - enzo27 - 11.11.2013

Hi how can I make more random spawn from each gang? As you can see from below each gang it only spawn 1 spawn point. I need TEAM_MEXICANS = 3 different spawn points and same with the rest.

Код:
new ZoneInfo[][eZone] =
{
    {-2814.9235, 86.0277, -2614.9511, 573.7998,TEAM_MEXICANS},
    {-2261.0000, -59.9213, -2003.0356, 395.8932,TEAM_BIKER},
    {-2818.9230, -327.8485, -2426.9771, 64.0359,TEAM_MAFIA},
    {-2524.9636, 571.8009, -2276.9978, 959.5567,TEAM_YAKUZA},
    {-1899.0500, 609.7795, -1563.0963, 941.5693,TEAM_HOMELESS},
    {-2255.859375, 1022.4609375, -1599.609375, 1280.2734375,TEAM_GROVE}

};



Re: random spawn - Reera - 11.11.2013

Well what you can do first is to make a new randomspawn for all of your classes like this
pawn Код:
new Float:mexicanspawn[][6] = // change the 6 after how many positions you have
{
    {-2814.9235, 86.0277, -2614.9511, 573.7998}, // change all these to your own, I just used yours in the topic as an example
    {-2261.0000, -59.9213, -2003.0356, 395.8932},
    {-2818.9230, -327.8485, -2426.9771, 64.0359},
    {-2524.9636, 571.8009, -2276.9978, 959.5567},
    {-1899.0500, 609.7795, -1563.0963, 941.5693},
    {-2255.859375, 1022.4609375, -1599.609375, 1280.2734375}
};
new Float:bikerspawn[][6] =
{
    {-2814.9235, 86.0277, -2614.9511, 573.7998},
    {-2261.0000, -59.9213, -2003.0356, 395.8932},
    {-2818.9230, -327.8485, -2426.9771, 64.0359},
    {-2524.9636, 571.8009, -2276.9978, 959.5567},
    {-1899.0500, 609.7795, -1563.0963, 941.5693},
    {-2255.859375, 1022.4609375, -1599.609375, 1280.2734375}
};
and under PlayerSpawn use this
pawn Код:
new rand = random(sizeof(mexicanspawn)), rand2 = random(sizeof(bikerspawn));
    if(gTeam[playerid] == TEAM_MEXICANS) // Checks if the player is mexican team
    {
        SetPlayerPos(playerid,mexicanspawn[rand][0],[rand][1],mexicanspawn[rand][2]); // This will set the positions  we used on Float:mexicanspawn
    }
    if(gTeam[playerid] == TEAM_BIKER)  // same thing
    {
        SetPlayerPos(playerid,bikerspawn[rand2][0],bikerspawn[rand2][1],bikerspawn[rand2][2]); // same thing
    }
So you can do this for all of your classes and if you have like colors and stuff for the different team just add them under SetPlayerPos
Don't know if it works, tell me if you get errors


Re: random spawn - enzo27 - 11.11.2013

Quote:
Originally Posted by Reera
Посмотреть сообщение
Well what you can do first is to make a new randomspawn for all of your classes like this
pawn Код:
new Float:mexicanspawn[][6] = // change the 6 after how many positions you have
{
    {-2814.9235, 86.0277, -2614.9511, 573.7998}, // change all these to your own, I just used yours in the topic as an example
    {-2261.0000, -59.9213, -2003.0356, 395.8932},
    {-2818.9230, -327.8485, -2426.9771, 64.0359},
    {-2524.9636, 571.8009, -2276.9978, 959.5567},
    {-1899.0500, 609.7795, -1563.0963, 941.5693},
    {-2255.859375, 1022.4609375, -1599.609375, 1280.2734375}
};
new Float:bikerspawn[][6] =
{
    {-2814.9235, 86.0277, -2614.9511, 573.7998},
    {-2261.0000, -59.9213, -2003.0356, 395.8932},
    {-2818.9230, -327.8485, -2426.9771, 64.0359},
    {-2524.9636, 571.8009, -2276.9978, 959.5567},
    {-1899.0500, 609.7795, -1563.0963, 941.5693},
    {-2255.859375, 1022.4609375, -1599.609375, 1280.2734375}
};
and under PlayerSpawn use this
pawn Код:
new rand = random(sizeof(mexicanspawn)), rand2 = random(sizeof(bikerspawn));
    if(gTeam[playerid] == TEAM_MEXICANS) // Checks if the player is mexican team
    {
        SetPlayerPos(playerid,mexicanspawn[rand][0],[rand][1],mexicanspawn[rand][2]); // This will set the positions  we used on Float:mexicanspawn
    }
    if(gTeam[playerid] == TEAM_BIKER)  // same thing
    {
        SetPlayerPos(playerid,bikerspawn[rand2][0],bikerspawn[rand2][1],bikerspawn[rand2][2]); // same thing
    }
So you can do this for all of your classes and if you have like colors and stuff for the different team just add them under SetPlayerPos
Don't know if it works, tell me if you get errors
Thanks for your warm reply. I haven't test it yet but it seems like its going to work. But how about this?

Quote:

new ZoneInfo[][eZone] =

This is really important can you apply it?

Quote:

new ZoneID[sizeof(ZoneInfo)];

new Teams[] = {
TEAM_MEXICANS,
TEAM_BIKER,
TEAM_MAFIA,
TEAM_YAKUZA,
TEAM_HOMELESS,
TEAM_GROVE
};

new ZoneAttacker[sizeof(ZoneInfo)] = {-1, ...};
new ZoneAttackTime[sizeof(ZoneInfo)];




Re: random spawn - Reera - 11.11.2013

Well I don't know what it is but after what I see, I don't think it belongs to anyting that have to do with the spawns