SA-MP Forums Archive
Help please. - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help please. (/showthread.php?tid=77562)



Help please. - Klutty - 12.05.2009

Im currently working on a roof dm script. It will be placed on a roof with random spawns etc.

If many people are on the roof fighting, it will be spawnkills all the time. So I'm wondering, can you do so at OnPlayerSpawn, the player spawns at a safe place, non controllabe (TogglePlayerControllable, I know) and then after 3 seconds you spawn up on the roof with random spawns, I got the random spawn code..

This I got right now,:
pawn Код:
const MAX_POSITIONS = 2;
    static Float:Positions[MAX_POSITIONS][4] =
    {
        {2402.6143, -2029.0471, 21.8350, 89.8074},
        {2367.6816,-2024.3185,21.8350,269.1808}
    }, bool:taken[MAX_POSITIONS];
    new freePos;
    for(; freePos < MAX_POSITIONS; freePos++)
        if(!taken[freePos]) break;
    if(freePos == MAX_POSITIONS) return 1; //no free positions left
    SetPlayerPos(playerid, Positions[freePos][0], Positions[freePos][1], Positions[freePos][2]);
    SetPlayerFacingAngle(playerid, Positions[freePos][3]);
    taken[freePos] = true;
    return 1;
Is this possible? If so please teach me or give me code.

Thank you


Re: Help please. - Weirdosport - 12.05.2009

If you made a random spawn function, in the form: RandomSpawn(playerid);

Then using 2 timers (if you teleport a player OnPlayerSpawn it won't work I don't think there has to be a timer there aswell ) you could:

pawn Код:
forward SafePlace(playerid);
forward RandomSpawn(playerid);

public OnPlayerSpawn(playerid)
{
SetTimerEx("SafePlace", 1000, 0, "d", playerid);
}

stock SafePlace(playerid)
{
//put player in safe place, toggle uncontrollable
SetTimerEx("RandomSpawn", 3000, 0, "d", playerid);
}

public RandomSpawn(playerid)
{
//Put player in the battle, toggle controllable
}
Alternatively you could make the AddPlayerClass default location the safe place, and then OnPlayerSpawn you'd only have to toggle them uncontrollable..


Re: Help please. - Klutty - 12.05.2009

Thank you VERY much!