SA-MP Forums Archive
VehicleID confliction - 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: VehicleID confliction (/showthread.php?tid=590660)



VehicleID confliction - JaKe Elite - 02.10.2015

So i have been scripting a minigame for a server i am working for.
So far everything works fine, When suddenly the vehicle (part of the script of mine) disappears,
The script then sends a message to everyone that another player got the vehicle (I already have it the time it disappears so it should be mine, I am under the Evade Mode for 30 seconds)

I am not sure if it has to do with the script or it is a vehicleID confliction on SA-MP. (The player possibly spawns a vehicle with /v and the script mistakenly identified the new spawned vehicle as the current vehicle of the script.)

My script is placed as filterscript.

For some reason i cannot show you the whole script so i will be only giving you the necessary stuffs on the problem.

Code:

PHP код:
new vehicle_id;
forward FindTheVehicle();
public 
FindTheVehicle()
{
    new 
string[150];
    new 
zone[48];
    if(
player_found == -1)
    {
        
GetVehicle2DZone(vehicle_idzone48);
        
        
loop_var ++;
        if(
loop_var <= 2)
        {
            
format(stringsizeof(string), "> The vehicle hasn't been founded yet, Find it for reward! (Location: %s)"zone);
            
SendClientMessageToAll(-1string);
        }
        else if(
loop_var == 3)
        {
            
format(stringsizeof(string), "> The vehicle hasn't been founded, A new game will start in another 8 minutes.");
            
SendClientMessageToAll(-1string);
            
KillTimer(vehicle_timer);
            
KillTimer(countdown_timer);
            
player_found = -2;
            
hijack_time 30;
            
loop_var 0;
            
DestroyVehicle(vehicle_id);
            
Delete3DTextLabel(vehicle_label);
        }
    }
    else if(
player_found == -2)
    {
        new 
randomv random(sizeof(FTVSPAWN));
        
player_found = -1;
        
vehicle_id CreateVehicle(FTVSPAWN[randomv][v_model], FTVSPAWN[randomv][x_pos], FTVSPAWN[randomv][y_pos], FTVSPAWN[randomv][z_pos], FTVSPAWN[randomv][a_pos], 255255, -1);
        
vehicle_label Create3DTextLabel("Minigame Vehicle\nPick it up to win rewards!"0xE0FFFFAA0.00.00.0250.0, -11);
        
Attach3DTextLabelToVehicle(vehicle_labelvehicle_id0.00.00.0);
        
SetVehicleHealth(vehicle_id1000000000.0);
        
GetVehicle2DZone(vehicle_idzone48);
        
format(stringsizeof(string), "> A \"%s\" has been spawned at %s, Pick it up and win rewards!"VehicleNames[FTVSPAWN[randomv][v_model]-400], zone);
        
SendClientMessageToAll(-1string);
    }
    else if(
player_found != -|| player_found != -2)
    {
        new 
pName[24];
        
GetPlayerName(player_foundpName24);
        
GetVehicle2DZone(vehicle_idzone48);
        
format(stringsizeof string"> Player %s (ID: %d) has got the vehicle, Get it before the player ends their evade time."pNameplayer_found);
        
SendClientMessageToAll(-1string);
        
format(stringsizeof string"> Player's location: %s"zone);
        
SendClientMessageToAll(-1string);
    }
    return 
1;




Re: VehicleID confliction - JaKe Elite - 03.10.2015

Bump.

4char