Need help badly
#1

Ok I'm having some problems with too many cars spawning at some checkpoints. I have a map where players use different cars. Once they drive into a checkpoint it deletes their car and puts them into a different one. That works fine, but for some reason after the servers been running for awhile and you drive to the checkpoints on that map you'll see many cars spawned around it. Here's a pic, http://i28.tinypic.com/rmkzlu.png

There's also a checkpoint infront. I just want it so the extra cars don't spawn. Here's the code I have for this and the rest of the checkpoints. Any help would be great thanks.

pawn Код:
if (gCheckpoint[0] == checkpointid)
    {
    new currentveh;
    currentveh = GetPlayerVehicleID(playerid);
    DestroyVehicle(currentveh);
    new Float:X,Float:Y,Float:Z,Float:A;
    GetPlayerPos(playerid,X,Y,Z);
    GetPlayerFacingAngle(playerid,A);
    SpawnedVehicles[playerid] = CreateVehicle(510,X,Y,Z,A,-1,-1,-1);
    SetVehicleVirtualWorld(SpawnedVehicles[playerid], GetPlayerVirtualWorld(playerid));
    PutPlayerInVehicle(playerid,SpawnedVehicles[playerid],0);
    TogglePlayerDynamicCP(playerid, checkpointid, false);
    }
Reply
#2

Are you sure those players don't disconnect?
Reply
#3

Put a line in OnPlayerDisconnect(playerid) that destroys the vehicle if they crash / quit
also maybe a line in OnPlayerChangeState that checks if oldstate == PLAYER_STATE_DRIVER and newstate == PLAYER_STATE_ONFOOT, and destroy the car then.

etc.

You have to cover every possible outcome.
Reply
#4

Quote:
Originally Posted by Hiddos
Посмотреть сообщение
Are you sure those players don't disconnect?
It's something to do with the checkpoint code I'm guessing. Reason is every checkpoint in that map has cars spawned all around it. It's frustrating cause I can't figure out whats causing it. :/ I'm new to scripting but looking at the code it should work. Not sure why it's spawning more of those cars.

Ok thanks Rachael, I'll try that out.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)