Vehicles disappearing
#1

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?
Reply
#2

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.
Reply
#3

update server to 0.3x
Reply
#4

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.
Reply
#5

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

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.
Reply
#7

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.
Reply
#8

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+.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)