08.02.2019, 09:21
I removed the vehicle ID and forwarded FireRateTimer, didn\'t work.
Here is the script with all lines, sorry for not posting it in the first place. It\'s line 37
Here is the script with all lines, sorry for not posting it in the first place. It\'s line 37
Code:
1 #include <a_samp> 2 #include <foreach> 3 #include <colandreas> 4 #include <streamer> 5 #include <3DTryg> 6 #include <Missile> 7 #include <VehicleMissileCol> 8 9 #define PRESSED(%0) \ 10 (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0))) 11 #define RELEASED(%0) \ 12 (((oldkeys & (%0)) == (%0)) && ((newkeys & (%0)) != (%0))) 13 14 new bool:autoFireButton[MAX_PLAYERS]; 15 static const c_AutoFireRate = 50; //define the rate of fire in milliseconds 16 17 public OnGameModeInit() 18 { 19 SetTimer("FireRateTimer", c_AutoFireRate, true); 20 return 1; 21 } 22 23 forward FireRateTimer(playerid); 24 public FireRateTimer(playerid) 25 { 26 if(autoFireButton[playerid]) 27 OnVehicleShot(playerid,VEHICLE_MISSILE_TYPE_CON); 28 return 1; 29 } 30 31 forward FireRateTimer(playerid); 32 public OnPlayerKeyStateChange(playerid, newkeys, oldkeys){ 33 if(IsPlayerInAnyVehicle(playerid) && GetPlayerVehicleSeat(playerid) == 0){ 34 new vid = GetPlayerVehicleID(playerid); 35 if(IsToggleVehicleCongreve(vid)){ 36 if(PRESSED(GetVehicleCongreveKey(vid))){ 37 if(FireRateTimer[playerid] != -1) return 1; // <-- This is the line which gives the error 38 FireRateTimer[playerid] = SetTimerEx("MissileFunction", 1000, true, "d", playerid); 39 SendClientMessage(playerid, 0x00FF00FF, "button pressed."); 40 } 41 if(RELEASED(GetVehicleCongreveKey(vid))){ 42 if(FireRateTimer[playerid] != -1) { 43 KillTimer(FireRateTimer[playerid]); 44 FireRateTimer[playerid] = -1; 45 SendClientMessage(playerid, 0x00FF00FF, "button released."); 46 } 47 } 48 } 49 } 50 return 1; }