Spawning at random place
#1

I have spec system there it save the latest x, y, z position, when you go off spec you are suposed to spawn there but i dont, i spawn instead at here


pawn Код:
//onplayerspawn
    if(InDMS[playerid] == 1)
    {
        new DMSRandom = random(sizeof(RandomDMSpawns));
        SetPlayerPos(playerid, RandomDMSpawns[DMSRandom][0], RandomDMSpawns[DMSRandom][1], RandomDMSpawns[DMSRandom][2]);
        SetPlayerFacingAngle(playerid, RandomDMSpawns[DMSRandom][3]);
        SetTimer("DMSTimer", 3000, false);
    }
Reply
#2

That's no use at all, we'd need the spec off command and how you save the last player coord.
Reply
#3

pawn Код:
//specoff command
    SetPlayerPos(playerid, SpecX[playerid], SpecY[playerid], SpecZ[playerid]);
    SetPlayerInterior(playerid, SpecInterior[playerid]);
    SetPlayerVirtualWorld(playerid, SpecVWorld[playerid]);

//spec command     
GetPlayerPos(playerid, SpecX[playerid], SpecY[playerid], SpecZ[playerid]);
        SpecInterior[playerid] = GetPlayerInterior(playerid);
        SpecVWorld[playerid] = GetPlayerVirtualWorld(playerid);
Reply
#4

You could try setting a timer when you spec off, for around 200ms and in the timer set the players position to their last one, that's what I do, and it seems to work fine.
Reply
#5

Hm... Dont really understand
Reply
#6

Example:
pawn Код:
CMD:specoff(playerid) {
// TogglePlayerSpec and all the other stuff here.
SetTimerEx("SpecOffSpawn", 200, false, "i", playerid);
return 1;
}

forward SpecOffSpawn(playerid);
public SpecOffSpawn(playerid) {
    SetPlayerPos(playerid, SpecX[playerid], SpecY[playerid], SpecZ[playerid]);
    SetPlayerInterior(playerid, SpecInterior[playerid]);
    SetPlayerVirtualWorld(playerid, SpecVWorld[playerid]);
return 1;
}
Reply
#7

And remove all other setplayerpos, interior etc from spec command and specoff?
Reply
#8

No no, keep it on the spec on command, but remove it from the spec off command, just keep the timer on there and the rest of the spec related stuff.
Reply
#9

Thanks man +rep
Reply
#10

i need help with this, no work :/
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)