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.
PHP код:
new vehicle_id;
forward FindTheVehicle();
public FindTheVehicle()
{
new string[150];
new zone[48];
if(player_found == -1)
{
GetVehicle2DZone(vehicle_id, zone, 48);
loop_var ++;
if(loop_var <= 2)
{
format(string, sizeof(string), "> The vehicle hasn't been founded yet, Find it for reward! (Location: %s)", zone);
SendClientMessageToAll(-1, string);
}
else if(loop_var == 3)
{
format(string, sizeof(string), "> The vehicle hasn't been founded, A new game will start in another 8 minutes.");
SendClientMessageToAll(-1, string);
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], 255, 255, -1);
vehicle_label = Create3DTextLabel("Minigame Vehicle\nPick it up to win rewards!", 0xE0FFFFAA, 0.0, 0.0, 0.0, 250.0, -1, 1);
Attach3DTextLabelToVehicle(vehicle_label, vehicle_id, 0.0, 0.0, 0.0);
SetVehicleHealth(vehicle_id, 1000000000.0);
GetVehicle2DZone(vehicle_id, zone, 48);
format(string, sizeof(string), "> A \"%s\" has been spawned at %s, Pick it up and win rewards!", VehicleNames[FTVSPAWN[randomv][v_model]-400], zone);
SendClientMessageToAll(-1, string);
}
else if(player_found != -1 || player_found != -2)
{
new pName[24];
GetPlayerName(player_found, pName, 24);
GetVehicle2DZone(vehicle_id, zone, 48);
format(string, sizeof string, "> Player %s (ID: %d) has got the vehicle, Get it before the player ends their evade time.", pName, player_found);
SendClientMessageToAll(-1, string);
format(string, sizeof string, "> Player's location: %s", zone);
SendClientMessageToAll(-1, string);
}
return 1;
}
Bump.