Jump to content

symbol already defined: "OnVehicleSpawn Help...


Recommended Posts

Geplaatst:

Hoi,

Ik had een script gedownload en die wou ik in mijn gamemode zetten, maar ik krijg een error bij het compilen.

Error 021 "symbol already defined: "OnVehicleSpawn

Help my :muur:

(dikgedrukte is waar het fout is)

forward FlasherFunc();

new obj[MAX_VEHICLES] = { INVALID_OBJECT_ID, ... };

new obj2[MAX_VEHICLES] = { INVALID_OBJECT_ID, ... };

new LightPwr[MAX_VEHICLES];

new Flasher[MAX_VEHICLES] = 0;

new FlasherState[MAX_VEHICLES];

new FlashTimer;

public OnFilterScriptInit()

{

print("\n--------------------------------------");

print(" Police Flash lights V2.1");

print(" By Stefantjuh97");

print("--------------------------------------\n");

for (new x=0; x<MAX_VEHICLES; x++)

{

LightPwr[x]=1;

Flasher[x]=0;

FlasherState[x]=0;

}

FlashTimer = SetTimer("FlasherFunc",200,1); // "200" is the speed from the flashing headlights

return 1;

}

public OnFilterScriptExit()

{

KillTimer(FlashTimer);

for (new i = 0; i < MAX_VEHICLES; i++)

{

DestroyObject(obj);

DestroyObject(obj2);

}

return 1;

}

public OnVehicleSpawn(vehicleid)

{

DestroyObject(obj[vehicleid]);

DestroyObject(obj2[vehicleid]);

return 1;

}

public OnVehicleDeath(vehicleid, killerid)

{

DestroyObject(obj[vehicleid]);

DestroyObject(obj2[vehicleid]);

return 1;

}

command(flash, playerid, params[])

{

new vehicleid,panels,doors,lights,tires;

vehicleid = GetPlayerVehicleID(playerid);

if(!Flasher[vehicleid]) {

if (GetPlayerState(playerid) != PLAYER_STATE_DRIVER)

{

return SendClientMessage(playerid, -1, "* You are not the driver!");

}

if (!GetVehicleModel(vehicleid)) return SendClientMessage(playerid, -1, "* You are not in a vehicle!");

if (IsValidObject(obj[vehicleid]) || IsValidObject(obj2[vehicleid]))

{

SendClientMessage(playerid, -1, "You switched off the lights."), DestroyObject(obj[vehicleid]), DestroyObject(obj2[vehicleid]);

GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);

if(LightPwr[vehicleid] == 1)

UpdateVehicleDamageStatus(vehicleid, panels, doors, 0, tires);

else

UpdateVehicleDamageStatus(vehicleid, panels, doors, 5, tires);

Flasher[vehicleid] = 0;

}

switch (GetVehicleModel(vehicleid))

{

case 596:

{

obj[vehicleid] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);

obj2[vehicleid] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);

AttachObjectToVehicle(obj[vehicleid], vehicleid, 0.599999,-0.375000,0.899999,0.000000,0.000000,0.000000);

AttachObjectToVehicle(obj2[vehicleid], vehicleid, -0.599999,-0.375000,0.899999,0.000000,0.000000,0.000000);

GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);

Flasher[vehicleid] = 1;

}

case 597:

{

obj[vehicleid] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);

obj2[vehicleid] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);

AttachObjectToVehicle(obj[vehicleid], vehicleid, 0.599999,-0.375000,0.899999,0.000000,0.000000,0.000000);

AttachObjectToVehicle(obj2[vehicleid], vehicleid, -0.599999,-0.375000,0.899999,0.000000,0.000000,0.000000);

GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);

Flasher[vehicleid] = 1;

}

case 598:

{

obj[vehicleid] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);

obj2[vehicleid] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);

AttachObjectToVehicle(obj[vehicleid], vehicleid, 0.524999, -0.300000, 0.899999, 0.000000, 0.000000, 0.000000);

AttachObjectToVehicle(obj2[vehicleid], vehicleid, -0.524999, -0.300000, 0.899999, 0.000000, 0.000000, 0.000000);

GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);

Flasher[vehicleid] = 1;

}

case 599:

{

obj[vehicleid] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);

obj2[vehicleid] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);

AttachObjectToVehicle(obj[vehicleid], vehicleid, 0.524999,0.000000,1.125000,0.000000,0.000000,0.000000);

AttachObjectToVehicle(obj2[vehicleid], vehicleid, -0.524999,0.000000,1.125000,0.000000,0.000000,0.000000);

GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);

Flasher[vehicleid] = 1;

}

case 541://bullet

{

obj[vehicleid] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);

AttachObjectToVehicle(obj[vehicleid], vehicleid, 0.375000,0.524999,0.375000,0.000000,0.000000,0.000000);

GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);

Flasher[vehicleid] = 1;

}

case 426://premier

{

obj[vehicleid] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);

AttachObjectToVehicle(obj[vehicleid], vehicleid, 0.524999,0.749999,0.375000,0.000000,0.000000,0.000000);

GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);

Flasher[vehicleid] = 1;

}

case 427://enforcer

{

GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);

Flasher[vehicleid] = 1;

}

case 416://Ambulance

{

GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);

Flasher[vehicleid] = 1;

}

case 407://FireTruck

{

GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);

Flasher[vehicleid] = 1;

}

case 560://sultan

{

obj[vehicleid] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);

AttachObjectToVehicle(obj[vehicleid], vehicleid, 0.225000,0.750000,0.449999,0.000000,0.000000,0.000000);

GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);

Flasher[vehicleid] = 1;

}

case 490://FBI

{

obj[vehicleid] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);

AttachObjectToVehicle(obj[vehicleid], vehicleid, 0.000000,1.125000,0.599999,0.000000,0.000000,0.000000);

GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);

Flasher[vehicleid] = 1;

}

default:

{

return SendClientMessage(playerid, -1, "You are not in a CODE 2 compatible police vehicle!");

}

}

return SendClientMessage(playerid, -1, "Lights on, you are now in a CODE 2 run!");

} else {

if (IsValidObject(obj[vehicleid]) || IsValidObject(obj2[vehicleid])) {

SendClientMessage(playerid, -1, "You switched off the lights."), DestroyObject(obj[vehicleid]), DestroyObject(obj2[vehicleid]);

}

GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);

if(LightPwr[vehicleid] == 1)

UpdateVehicleDamageStatus(vehicleid, panels, doors, 0, tires);

else

UpdateVehicleDamageStatus(vehicleid, panels, doors, 5, tires);

Flasher[vehicleid] = 0;

}

return 1;

}

Geplaatst:

Je hebt hoogstwaarschijnlijk al een "OnVehicleSpawn" in jou gamemode. :) Je kan deze samenvoegen tot één OnVehicleSpawn door alles wat in deze staat te kopiëren naar de OnVehicleSpawn in jou gamemode. De rest kan je er dan natuurlijk ook bij zetten.

Geplaatst:

TIP: Als je dingen van een FilterScript naar je GameMode plaatst moet je alles wat in OnFilterScriptInit en OnFilterScritptExit in OnGameModeInit en OnGameModeExit zetten

Een reactie plaatsen

Je kan nu een reactie plaatsen en pas achteraf registreren. Als je al lid bent, log eerst in om met je eigen account een reactie te plaatsen.

Gast
Op dit onderwerp reageren...

×   Je hebt text geplaatst met opmaak.   Opmaak verwijderen

  Only 75 emoji are allowed.

×   Je link is automatisch ingevoegd.   In plaats daarvan weergeven als link

×   Je vorige bewerkingen zijn hersteld.   Alles verwijderen

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent actief   0 leden

    • Er zijn hier geen geregistreerde gebruikers aanwezig.
×
×
  • Create New...