SA-MP Forums Archive
Vehicles disappearing - 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: Vehicles disappearing (/showthread.php?tid=408919)



Vehicles disappearing - Mellnik - 19.01.2013

I got an command which let users spawn any vehicle, the vehicleid will be saved into a variable, so when the variable is not -1 by using this command, the vehicle stored into that var will be destroyed.

But when there more than 25 players online a weird problem happens, vehicles from other players gets destroyed...

Does anyone know whats the issue here?


Re: Vehicles disappearing - DeathOnaStick - 19.01.2013

I'd need your code for that. The declaration of the variable, the method that stores the IDs and the method that destroys the vehicles.


Re: Vehicles disappearing - Sr_Piky - 19.01.2013

update server to 0.3x


AW: Vehicles disappearing - Mellnik - 19.01.2013

pawn Код:
CarSpawner(playerid, model)
{
    if(model == 432 || model == 520 || model == 425)
    {
        if(PlayerInfo[playerid][Level] <= 3)
        {
            return LangMSG(playerid, -1, ""er"Only admins can spawn this", ""er"Nur Admins kцnnen das spawnen");
        }
    }
        if(PlayerInfo[playerid][Vehicle] != -1)
        {
            DestroyVehicle(PlayerInfo[playerid][Vehicle]);
            PlayerInfo[playerid][Vehicle] = -1;
        }  

    new
        Float:POS[4],
        string[18];

    GetPlayerPos(playerid, POS[0], POS[1], POS[2]);
    GetPlayerFacingAngle(playerid, POS[3]);
    PlayerInfo[playerid][Vehicle] = CreateVehicle(model, POS[0], POS[1], POS[2], POS[3], -1, -1, -1);
    SetVehicleVirtualWorld(PlayerInfo[playerid][Vehicle], GetPlayerVirtualWorld(playerid));
    LinkVehicleToInterior(PlayerInfo[playerid][Vehicle], GetPlayerInterior(playerid));
    SetVehicleNumberPlate(PlayerInfo[playerid][Vehicle], ""red"NGS");
    SetVehicleToRespawn(PlayerInfo[playerid][Vehicle]);
    PutPlayerInVehicle(playerid, PlayerInfo[playerid][Vehicle], 0);
    return 1;
}
At the command this function gets called.

Quote:
Originally Posted by Sr_Piky
Посмотреть сообщение
update server to 0.3x
No its working on other big servers too.


Re: Vehicles disappearing - DeathOnaStick - 19.01.2013

Do you reset "PlayerInfo[playerid][Vehicle]" to -1 at OnPlayer(Dis)connect? If not, you should do that.


AW: Re: Vehicles disappearing - Mellnik - 19.01.2013

Quote:
Originally Posted by DeathOnaStick
Посмотреть сообщение
Do you reset "PlayerInfo[playerid][Vehicle]" to -1 at OnPlayer(Dis)connect? If not, you should do that.
It's being reset on PlayerConnect and PlayerDisconnect.


Re: Vehicles disappearing - DeathOnaStick - 19.01.2013

Well, the only thing I could think about now is that the variable is too small or incompatible, or it's just an internal sa-mp bug. Code seems legit for me.


AW: Re: Vehicles disappearing - Mellnik - 19.01.2013

Quote:
Originally Posted by DeathOnaStick
Посмотреть сообщение
Well, the only thing I could think about now is that the variable is too small or incompatible, or it's just an internal sa-mp bug. Code seems legit for me.
The var is declared as a normal Integer. Thanks for answers rep+.