#include <a_samp>
#define COLOR_RED 0xAA3333AA
#define DIALOG1_MSG \"Sultan [mûszerfal]\\nSultan [tetõ]\\n\\nWashington [mûszerfal]\\nWashington [tetõ]\"
new IsSpu[MAX_VEHICLES] = 0;
new Lamp[MAX_VEHICLES] = 0;
new light[MAX_VEHICLES];
enum Coords
{
SPU,
VehicleID,
Float:X,
Float:Y,
Float:Z,
};
new Offsets[33][Coords] = {
{1, 560, 0.398071289,0.75390625,0.43879509}, // Sultan [mûszerfal]
{2, 560, -0.35644531250, 0.0388183593, 0.863788605}, // Sultan [tetõ]
{3, 421, 0.421691895, 0.804931641, 0.256482124}, // Washington [mûszerfal]
{4, 421, -0.323303223, 0.0207519532, 0.731482506}, // Washington [tetõ]
};
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(\"/spu\", cmdtext, true) == 0)
{
#if defined ADMIN_USE
if(!IsPlayerAdmin(playerid)) return 1;
#endif
#if defined POLICE_USE
if(GetPlayerSkin(playerid) != 280 && GetPlayerSkin(playerid) != 281 && GetPlayerSkin(playerid) != 282 && GetPlayerSkin(playerid) != 283 && GetPlayerSkin(playerid) != 284 && GetPlayerSkin(playerid) != 285 && GetPlayerSkin(playerid) != 286 && GetPlayerSkin(playerid) != 287 && GetPlayerSkin(playerid) != 288) return 1;
#endif
ShowPlayerDialog(playerid, 1123, DIALOG_STYLE_LIST, \"Civil kocsira szeretnél szirénát?\", DIALOG1_MSG, \"Szeretnék!\", \"Nem!\" );
return 1;
}
if (strcmp(\"/destroyspu\", cmdtext, true) == 0)
{
#if defined ADMIN_USE
if(!IsPlayerAdmin(playerid)) return 1;
#endif
#if defined POLICE_USE
if(GetPlayerSkin(playerid) != 280 && GetPlayerSkin(playerid) != 281 && GetPlayerSkin(playerid) != 282 && GetPlayerSkin(playerid) != 283 && GetPlayerSkin(playerid) != 284 && GetPlayerSkin(playerid) != 285 && GetPlayerSkin(playerid) != 286 && GetPlayerSkin(playerid) != 287 && GetPlayerSkin(playerid) != 288) return 1;
#endif
if(IsPlayerConnected(playerid))
{
new vid = GetPlayerVehicleID(playerid);
if(IsSpu[vid] > 0)
{
IsSpu[vid] = 0;
if(Lamp[vid] == 1)
{
DestroyObject(light[vid]);
Lamp[vid] = 0;
}
DestroyVehicle(vid);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_RED, \"Nem vagy megfelelõ típusú kocsiban!\");
}
}
return 1;
}
return 0;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(response == 1 && dialogid == 1123)
{
switch(listitem)
{
case 0:
{
new Float:x, Float:y, Float:z, Float:angle;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, angle);
for(new i=0; i<sizeof(Offsets); i++)
{
if(Offsets[sPU] == 1)
{
new vehicleid=CreateVehicle(Offsets[VehicleID], x, y, z, angle, 0, 0, -1);
PutPlayerInVehicle(playerid, vehicleid, 0);
SetVehicleVirtualWorld(vehicleid, GetPlayerVirtualWorld(playerid));
LinkVehicleToInterior(vehicleid, GetPlayerInterior(playerid));
light[vehicleid] = CreateObject(18646,Offsets[X], Offsets[Y], Offsets[Z], 0.0, 0.0, 96.0);
AttachObjectToVehicle(light[vehicleid], vehicleid, Offsets[X], Offsets[Y], Offsets[Z], 0.0, 0.0, 0.0);
Lamp[vehicleid] = 1;
IsSpu[vehicleid] = 1;
}
}
}
case 1:
{
new Float:x, Float:y, Float:z, Float:angle;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, angle);
for(new i=0; i<sizeof(Offsets); i++)
{
if(Offsets[sPU] == 2)
{
new vehicleid=CreateVehicle(Offsets[VehicleID], x, y, z, angle, 0, 0, -1);
PutPlayerInVehicle(playerid, vehicleid, 0);
SetVehicleVirtualWorld(vehicleid, GetPlayerVirtualWorld(playerid));
LinkVehicleToInterior(vehicleid, GetPlayerInterior(playerid));
light[vehicleid] = CreateObject(18646,Offsets[X], Offsets[Y], Offsets[Z], 0.0, 0.0, 96.0);
AttachObjectToVehicle(light[vehicleid], vehicleid, Offsets[X], Offsets[Y], Offsets[Z], 0.0, 0.0, 0.0);
Lamp[vehicleid] = 1;
IsSpu[vehicleid] = 2;
}
}
}
case 2:
{
new Float:x, Float:y, Float:z, Float:angle;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, angle);
for(new i=0; i<sizeof(Offsets); i++)
{
if(Offsets[sPU] == 3)
{
new vehicleid=CreateVehicle(Offsets[VehicleID], x, y, z, angle, 0, 0, -1);
PutPlayerInVehicle(playerid, vehicleid, 0);
SetVehicleVirtualWorld(vehicleid, GetPlayerVirtualWorld(playerid));
LinkVehicleToInterior(vehicleid, GetPlayerInterior(playerid));
light[vehicleid] = CreateObject(18646,Offsets[X], Offsets[Y], Offsets[Z], 0.0, 0.0, 96.0);
AttachObjectToVehicle(light[vehicleid], vehicleid, Offsets[X], Offsets[Y], Offsets[Z], 0.0, 0.0, 0.0);
Lamp[vehicleid] = 1;
IsSpu[vehicleid] = 3;
}
}
}
case 3:
{
new Float:x, Float:y, Float:z, Float:angle;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, angle);
for(new i=0; i<sizeof(Offsets); i++)
{
if(Offsets[sPU] == 4)
{
new vehicleid=CreateVehicle(Offsets[VehicleID], x, y, z, angle, 0, 0, -1);
PutPlayerInVehicle(playerid, vehicleid, 0);
SetVehicleVirtualWorld(vehicleid, GetPlayerVirtualWorld(playerid));
LinkVehicleToInterior(vehicleid, GetPlayerInterior(playerid));
light[vehicleid] = CreateObject(18646,Offsets[X], Offsets[Y], Offsets[Z], 0.0, 0.0, 96.0);
AttachObjectToVehicle(light[vehicleid], vehicleid, Offsets[X], Offsets[Y], Offsets[Z], 0.0, 0.0, 0.0);
Lamp[vehicleid] = 1;
IsSpu[vehicleid] = 4;
}
}
}
}
}
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if((newkeys & KEY_SUBMISSION) && !(oldkeys & KEY_SUBMISSION))
{
VehicleLightSwitch(playerid);
}
return 1;
}
AddSPU(spuid, Float:x, Float:y, Float:z, Float:rotation, color1, color2, lightonoroff)
{
if(lightonoroff == 1)
{
for(new i=0; i<sizeof(Offsets); i++)
{
if(Offsets[sPU] == spuid)
{
new vehicleid = CreateVehicle(Offsets[VehicleID], x, y, z, rotation, color1, color2, -1);
Lamp[vehicleid] = 1;
IsSpu[vehicleid] = spuid;
light[vehicleid] = CreateObject(18646,Offsets[X], Offsets[Y], Offsets[Z], 0.0, 0.0, 96.0);
AttachObjectToVehicle(light[vehicleid], vehicleid, Offsets[X], Offsets[Y], Offsets[Z], 0.0, 0.0, 0.0);
printf(\"AddSPU(%d), sikeresen megcsinálva!\", spuid);
return 1;
}
}
}
if(lightonoroff == 0)
{
for(new i=0; i<sizeof(Offsets); i++)
{
if(Offsets[sPU] == spuid)
{
new vehicleid = CreateVehicle(Offsets[VehicleID], x, y, z, rotation, color1, color2, -1);
Lamp[vehicleid] = 0;
IsSpu[vehicleid] = spuid;
printf(\"AddSPU(%d), sikeresen megcsinálva!\", spuid);
return 1;
}
}
}
return 1;
}
VehicleLightSwitch(playerid)
{
new vid = GetPlayerVehicleID(playerid);
if(vid == INVALID_VEHICLE_ID) return 1;
if(IsSpu[vid] != 0)
{
if(Lamp[vid] == 1)
{
DestroyObject(light[vid]);
Lamp[vid] = 0;
return 1;
}
if(Lamp[vid] == 0)
{
for(new i=0; i<sizeof(Offsets); i++)
{
if(Offsets[sPU] == IsSpu[vid])
{
light[vid] = CreateObject(18646,Offsets[X], Offsets[Y], Offsets[Z], 0.0, 0.0, 96.0);
AttachObjectToVehicle(light[vid], vid, Offsets[X], Offsets[Y], Offsets[Z], 0.0, 0.0, 0.0);
Lamp[vid] = 1;
}
}
return 1;
}
}
return 1;
}