16.05.2012, 18:07
(
Last edited by KoczkaHUN; 17/05/2012 at 03:30 PM.
Reason: repaired
)
This very simple filterscript allows you to drive police vehicles (ID 596, 597, 598 and 599) in a Code 2 situation (only lights flashing, no siren).
The script requires SA:MP 0.3e to work. It is recommended to use the latest Incognito's streamer (2.6.1 or newer) (you can compile with those includes without editing the filterscript itself). It is also working perfectly without an object streamer as well.
Notes
The reason I am not using any command processor is there is only one command, for which strcmp is enough, too.
When you leave your vehicle with lights on, it remains flashing, but other players can get in your car and switch the lights off.
You can use it in your RP/CNR/whatever gamemode, just give me a comment about it. You can also edit it free.
Usage
Compile the script using 0.3e PAWNO, and load the filterscript.
As a driver in a LSPD/LVPD/SFPD/Police Rancher car type /code2 to control the lights.
If you are not the driver, or not in a controllable vehicle, you will be given a warning.
Code
Video
[ame]http://www.youtube.com/watch?v=2qNTMZ_Jo4U[/ame]
The script requires SA:MP 0.3e to work. It is recommended to use the latest Incognito's streamer (2.6.1 or newer) (you can compile with those includes without editing the filterscript itself). It is also working perfectly without an object streamer as well.
Notes
The reason I am not using any command processor is there is only one command, for which strcmp is enough, too.
When you leave your vehicle with lights on, it remains flashing, but other players can get in your car and switch the lights off.
You can use it in your RP/CNR/whatever gamemode, just give me a comment about it. You can also edit it free.
Usage
Compile the script using 0.3e PAWNO, and load the filterscript.
As a driver in a LSPD/LVPD/SFPD/Police Rancher car type /code2 to control the lights.
If you are not the driver, or not in a controllable vehicle, you will be given a warning.
Code
pawn Code:
#define FILTERSCRIPT
#include <a_samp>
#tryinclude <streamer>
#if defined _streamer_included
#define CObject CreateDynamicObject
#define AObject AttachDynamicObjectToVehicle
#define DObject DestroyDynamicObject
#define VObject IsValidDynamicObject
#else
#define CObject CreateObject
#define AObject AttachObjectToVehicle
#define DObject DestroyObject
#define VObject IsValidObject
#endif
new obj[MAX_VEHICLES] = { INVALID_OBJECT_ID, ... };
public OnFilterScriptInit()
{
print("Code 2 lights loaded.");
return 1;
}
public OnFilterScriptExit()
{
for (new i = 0; i < MAX_VEHICLES; i++)
{
DObject(obj[i]);
}
print("Code 2 lights unloaded.");
return 1;
}
public OnVehicleDeath(vehicleid, killerid)
{
DObject(obj[vehicleid]);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/code2", cmdtext, true, 6) == 0)
{
if (GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
{
return SendClientMessage(playerid, -1, "* You are not the driver!");
}
new pveh = GetPlayerVehicleID(playerid);
if (!GetVehicleModel(pveh)) return SendClientMessage(playerid, -1, "* You are not in a vehicle!");
if (VObject(obj[pveh])) return SendClientMessage(playerid, -1, "* You switched off the lights."), DObject(obj[pveh]);
switch (GetVehicleModel(pveh))
{
case 596:
{
obj[pveh] = CObject(19419, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
AObject(obj[pveh], pveh, 0.000000, -0.379999, 0.889999, 0.000000, 0.000000, 0.000000);
}
case 597:
{
obj[pveh] = CObject(19419, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
AObject(obj[pveh], pveh, 0.000000, -0.374999, 0.884999, 0.000000, 0.000000, 0.000000);
}
case 598:
{
obj[pveh] = CObject(19419, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
AObject(obj[pveh], pveh, 0.000000, -0.334498, 0.933500, 0.000000, 0.000000, 0.000000);
}
case 599:
{
obj[pveh] = CObject(19419, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
AObject(obj[pveh], pveh, 0.000000, 0.039999, 1.153999, 0.000000, 0.000000, 0.000000);
}
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!");
}
return 0;
}
[ame]http://www.youtube.com/watch?v=2qNTMZ_Jo4U[/ame]