if( pVehicleSpawned[playerid] != -1 ) // this variable need to be set to -1 at player connect or at any other place required
{
for( new i; i < MAX_PLAYERS; i++ )
{
if( IsPlayerInVehicle( i, pVehicleSpawned[playerid] ) DestroyVehicle( pVehicleSpawned[playerid] );// will delete vehicle id the playerid had spawned earlier if it is not occupied by anyone
}
}
pVehicleSpawned[playerid] = CreateVehicle(...); // create new vehicle and store vehicleid as seen by server in the variable..for playerid
//end
if(listid == vehlist) { if(response) { if( pVehicleSpawned[playerid] != -1 ) { for( new i; i < MAX_PLAYERS; i++ ) { if( IsPlayerInVehicle( i, pVehicleSpawned[playerid] ) DestroyVehicle( pVehicleSpawned[playerid] ); } } pVehicleSpawned[playerid] = CreateVehicle(...); new Float:pos[3]; GetPlayerPos(playerid, pos[0], pos[1], pos[2]); CreateVehicle(modelid, pos[0] + 2.5, pos[1], pos[2] + 2.5, 0.0, random(128), random(128), -1); } else { return 0; }
E:\pawn project\gamemodes\zzz.pwn(565) : error 017: undefined symbol "pVehicleSpawned" E:\pawn project\gamemodes\zzz.pwn(565) : warning 215: expression has no effect E:\pawn project\gamemodes\zzz.pwn(565) : error 001: expected token: ";", but found "]" E:\pawn project\gamemodes\zzz.pwn(565) : error 029: invalid expression, assumed zero E:\pawn project\gamemodes\zzz.pwn(565) : fatal error 107: too many error messages on one line
//-- top of script add under includes
new pVehicleSpawned[MAX_PLAYERS];
//------
//in onplayerconnect add this:
pVehicleSpawned[playerid] = -1;
//-------
if(listid == vehlist)
{
if(response)
{
if( pVehicleSpawned[playerid] != -1 )
{
for( new i; i < MAX_PLAYERS; i++ )
{
if( IsPlayerInVehicle( i, pVehicleSpawned[playerid] ) DestroyVehicle( pVehicleSpawned[playerid] );
}
}
new Float:pos[3]; GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
pVehicleSpawned[playerid] = CreateVehicle(modelid, pos[0] + 2.5, pos[1], pos[2] + 2.5, 0.0, random(128), random(128), -1);
}
else
{
return 0;
}
gactually u didnt understood what i mean tthere e.e
pawn Код:
|