17.06.2012, 14:22
Again not, oke here comes the whole code with all the things:
Don't watch about the "flasher" because thats working.
pawn Код:
new obj[MAX_VEHICLES] = { INVALID_OBJECT_ID, ... };
new obj2[MAX_VEHICLES] = { INVALID_OBJECT_ID, ... };
pawn Код:
public OnGameModeExit()
{
for (new i = 0; i < MAX_VEHICLES; i++)
{
DestroyObject(obj[i]);
DestroyObject(obj2[i]);
}
return 1;
}
pawn Код:
public OnVehicleSpawn(vehicleid)
{
printf("[DEBUG] Vehicle %d has spawned!", vehicleid);
DestroyObject(obj[vehicleid]);
DestroyObject(obj2[vehicleid]);
return 1;
}
public OnVehicleDeath(vehicleid, killerid)
{
DestroyObject(obj[vehicleid]);
DestroyObject(obj2[vehicleid]);
return 1;
}
pawn Код:
command(flash, playerid, params[])
{
new vehicleid,panels,doors,lights,tires;
if(Groups[Player[playerid][Group]][CommandTypes] == 1)
if (GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
{
return SendClientMessage(playerid, -1, "* You are not the driver!");
}
new pveh = GetPlayerVehicleID(playerid);
if (!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "* You are not in a vehicle!");
if(GetVehicleModel(pveh) == 596)
{
obj[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
obj2[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
AttachObjectToVehicle(obj[pveh], pveh, 0.599999,-0.375000,0.899999,0.000000,0.000000,0.000000);
AttachObjectToVehicle(obj2[pveh], pveh, -0.599999,-0.375000,0.899999,0.000000,0.000000,0.000000);
vehicleid = GetPlayerVehicleID(playerid);
GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
Flasher[vehicleid] = 1;
SCM(playerid, WHITE, "You are in a CODE 2");
}
else if(GetVehicleModel(pveh) == 597)
{
obj[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
obj2[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
AttachObjectToVehicle(obj[pveh], pveh, 0.599999,-0.375000,0.899999,0.000000,0.000000,0.000000);
AttachObjectToVehicle(obj2[pveh], pveh, -0.599999,-0.375000,0.899999,0.000000,0.000000,0.000000);
vehicleid = GetPlayerVehicleID(playerid);
GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
Flasher[vehicleid] = 1;
SCM(playerid, WHITE, "You are in a CODE 2");
}
else if(GetVehicleModel(pveh) == 598)
{
obj[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
obj2[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
AttachObjectToVehicle(obj[pveh], pveh, 0.524999, -0.300000, 0.899999, 0.000000, 0.000000, 0.000000);
AttachObjectToVehicle(obj2[pveh], pveh, -0.524999, -0.300000, 0.899999, 0.000000, 0.000000, 0.000000);
vehicleid = GetPlayerVehicleID(playerid);
GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
Flasher[vehicleid] = 1;
SCM(playerid, WHITE, "You are in a CODE 2");
}
else if(GetVehicleModel(pveh) == 599)
{
obj[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
obj2[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
AttachObjectToVehicle(obj[pveh], pveh, 0.524999,0.000000,1.125000,0.000000,0.000000,0.000000);
AttachObjectToVehicle(obj2[pveh], pveh, -0.524999,0.000000,1.125000,0.000000,0.000000,0.000000);
vehicleid = GetPlayerVehicleID(playerid);
GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
Flasher[vehicleid] = 1;
SCM(playerid, WHITE, "You are in a CODE 2");
}
else if(GetVehicleModel(pveh) == 541)
{
obj[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
AttachObjectToVehicle(obj[pveh], pveh, 0.375000,0.524999,0.375000,0.000000,0.000000,0.000000);
vehicleid = GetPlayerVehicleID(playerid);
GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
Flasher[vehicleid] = 1;
SCM(playerid, WHITE, "You are in a CODE 2");
}
else if(GetVehicleModel(pveh) == 426)
{
obj[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
AttachObjectToVehicle(obj[pveh], pveh, 0.524999,0.749999,0.375000,0.000000,0.000000,0.000000);
vehicleid = GetPlayerVehicleID(playerid);
GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
Flasher[vehicleid] = 1;
SCM(playerid, WHITE, "You are in a CODE 2");
}
else if(GetVehicleModel(pveh) == 427)
{
vehicleid = GetPlayerVehicleID(playerid);
GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
Flasher[vehicleid] = 1;
SCM(playerid, WHITE, "You are in a CODE 2");
}
else if(GetVehicleModel(pveh) == 560)
{
obj[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
AttachObjectToVehicle(obj[pveh], pveh, 0.225000,0.750000,0.449999,0.000000,0.000000,0.000000);
vehicleid = GetPlayerVehicleID(playerid);
GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
Flasher[vehicleid] = 1;
SCM(playerid, WHITE, "You are in a CODE 2");
}
else if(GetVehicleModel(pveh) == 490)
{
obj[pveh] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
AttachObjectToVehicle(obj[pveh], pveh, 0.000000,1.125000,0.599999,0.000000,0.000000,0.000000);
vehicleid = GetPlayerVehicleID(playerid);
GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
Flasher[vehicleid] = 1;
SCM(playerid, WHITE, "You are in a CODE 2");
}
else
{
SendClientMessage(playerid, -1, "You are not in a CODE 2 compatible police vehicle!");
}
return 1;
}
command(flashoff, playerid, params[])
{
new vehicleid,panels,doors,lights,tires;
new pveh = GetPlayerVehicleID(playerid);
if(Groups[Player[playerid][Group]][CommandTypes] == 1)
{
if (IsValidObject(obj[pveh]) || IsValidObject(obj2[pveh]))
SendClientMessage(playerid, -1, "You switched off the lights."), DestroyObject(obj[pveh]), DestroyObject(obj2[pveh]);
vehicleid = GetPlayerVehicleID(playerid);
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;
}