Help with Flash on Key
#1

Hello i SAMP FORUM i want a flash with key and command
i press CAPS LOCK and now its Flash on car when i write /majak its down not on car sry for my english

/*
© Stefantjuh97
Mail: S.dorst1997@gmail.com
SAMP Forum name: Stefand.
Release Date: 18-6-2012
Version: 3.0


Changelog V2.0
Fixed:
- Headlights keep flashing when you are out of the vehicle.
Thanks to BrandyPenguin

- if you did /flash 2 times without /flashoff you had a bugged vehicle.

Added:
- Working for ambulance
- Working for Firetruck

Changelog V3.0
Fixed:
- /flash for turning flash on and /flash for turning it off
Thanks to BrandyPenguin

Added:
- Nothing
*/

#include <a_samp>
#include <zcmd>

#define FILTERSCRIPT


new obj[MAX_VEHICLES] = { INVALID_OBJECT_ID, ... };
new obj2[MAX_VEHICLES] = { INVALID_OBJECT_ID, ... };
new obj3[MAX_VEHICLES] = { INVALID_OBJECT_ID, ... };
new obj4[MAX_VEHICLES] = { INVALID_OBJECT_ID, ... };
new obj5[MAX_VEHICLES] = { INVALID_OBJECT_ID, ... };
new obj6[MAX_VEHICLES] = { INVALID_OBJECT_ID, ... };
new LightPwr[MAX_VEHICLES];
new Flasher[MAX_VEHICLES] = 0;
new Flashert[MAX_VEHICLES] = 0;
new Flashertt[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;
Flashert[x]=0;
Flashertt[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[i]);
DestroyObject(obj2[i]);
DestroyObject(obj3[i]);
DestroyObject(obj4[i]);
DestroyObject(obj5[i]);
DestroyObject(obj6[i]);
}
return 1;
}




public OnVehicleSpawn(vehicleid)
{
DestroyObject(obj[vehicleid]);
DestroyObject(obj2[vehicleid]);
DestroyObject(obj3[vehicleid]);
DestroyObject(obj4[vehicleid]);
DestroyObject(obj5[vehicleid]);
DestroyObject(obj6[vehicleid]);
Flasher[vehicleid] = 0;
return 1;
}



public OnVehicleDeath(vehicleid, killerid)
{
DestroyObject(obj[vehicleid]);
DestroyObject(obj2[vehicleid]);
Flasher[vehicleid] = 0;
return 1;
}


command(majak, 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, "Sundal jsi strobбč"), DestroyObject(obj[vehicleid]), DestroyObject(obj2[vehicleid]) , DestroyObject(obj3[vehicleid]), DestroyObject(obj4[vehicleid]) , DestroyObject(obj5[vehicleid]);
Flashert[vehicleid] = 0;
}

if (IsValidObject(obj[vehicleid]) || IsValidObject(obj2[vehicleid])) {
SendClientMessage(playerid, -1, "You switched off the lights."), DestroyObject(obj[vehicleid]), DestroyObject(obj2[vehicleid]) , DestroyObject(obj3[vehicleid]), DestroyObject(obj4[vehicleid]) , DestroyObject(obj5[vehicleid]);
}
GetVehicleDamageStatus(vehicleid,panels,doors,ligh ts,tires);
if(LightPwr[vehicleid] == 1)
UpdateVehicleDamageStatus(vehicleid, panels, doors, 0, tires);
else
UpdateVehicleDamageStatus(vehicleid, panels, doors, 5, tires);
Flasher[vehicleid] = 0;
}
return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys == KEY_CROUCH)
{
new vehicleid,panels,doors,lights,tires;
vehicleid = GetPlayerVehicleID(playerid);
if(!Flasher[vehicleid]) {
if (!GetVehicleModel(vehicleid)) return SendClientMessage(playerid, -1, "* You are not in a vehicle!");
switch (GetVehicleModel(vehicleid))
{
case 541:
{
obj[vehicleid] = CreateObject(18646,0,0,-1000,0,0,0,100);
obj2[vehicleid] = CreateObject(19797,0,0,-1000,0,0,0,100);
AttachObjectToVehicle(obj[vehicleid], vehicleid, 0.525000,-0.150000,0.664999,-0.000010,0.000001,-8.099993);
AttachObjectToVehicle(obj2[vehicleid], vehicleid, 0.000000,0.450000,0.375000,180.899887,0.000000,0.0 00000);
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!");
}
return 1;
}

forward FlasherFunc();
public FlasherFunc() {
new panelsx,doorsx,lightsx,tiresx;
for (new p=0; p<MAX_VEHICLES; p++)
{
if (Flasher[p] == 1)
{
if (FlasherState[p] == 1)
{
GetVehicleDamageStatus(p,panelsx,doorsx,lightsx,ti resx);
UpdateVehicleDamageStatus(p, panelsx, doorsx, 4, tiresx);
FlasherState[p] = 0;
}
else
{
GetVehicleDamageStatus(p,panelsx,doorsx,lightsx,ti resx);
UpdateVehicleDamageStatus(p, panelsx, doorsx, 1, tiresx);
FlasherState[p] = 1;
}
}
}
return 1;
}

C:\Documents and Settings\Owner\Plocha\majaky.pwn(141) : warning 203: symbol is never used: "tires"
C:\Documents and Settings\Owner\Plocha\majaky.pwn(141) : warning 203: symbol is never used: "lights"
C:\Documents and Settings\Owner\Plocha\majaky.pwn(141) : warning 203: symbol is never used: "doors"
C:\Documents and Settings\Owner\Plocha\majaky.pwn(141) : warning 203: symbol is never used: "panels"
C:\Documents and Settings\Owner\Plocha\majaky.pwn(141 -- 165) : warning 217: loose indentation
C:\Documents and Settings\Owner\Plocha\majaky.pwn(165) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Owner\Plocha\majaky.pwn(165) : error 017: undefined symbol "FlasherFunc"
C:\Documents and Settings\Owner\Plocha\majaky.pwn(166) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Owner\Plocha\majaky.pwn(166) : error 017: undefined symbol "FlasherFunc"
C:\Documents and Settings\Owner\Plocha\majaky.pwn(18 : error 030: compound statement not closed at the end of file (started at line 139)
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)