Nos Key Problem
#1

Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	if(newkeys & KEY_SUBMISSION) // if somebody presses 2
	{
		if(IsNosTimer[playerid] == true)
		{
			SendClientMessage(playerid, 0xFFFF00AA, "Please Wait Before Using NOS!");
			return 1;
		}

		if(IsMotorBike(GetVehicleModel(GetPlayerVehicleID(playerid))))
		{
			Nos = SetTimerEx("NosTimer", 15000, false, "i", playerid);
			IsNosTimer[playerid] = true;
			SendClientMessage(playerid, 0xFFFF00AA, "Vehicle Is Not Modifiable!");
			return 1;
		}

		if(!IsMotorBike(GetVehicleModel(GetPlayerVehicleID(playerid))))
		{
			Nos = SetTimerEx("NosTimer", 15000, false, "i", playerid);
    	IsNosTimer[playerid] = true;
			SetVehicleHealth(GetPlayerVehicleID(playerid), 1000); //set car health to 1000
			AddVehicleComponent(GetPlayerVehicleID(playerid), 1010); //give player 10x nos.
			PlayerPlaySound(playerid, 1133, 0, 0 ,0); // little sound
			return 1;
		}
		return 1;
	}
	return 1;
}
This code is fully functional until it reaches a bike. The result is a crash via clientside, so nobody can access it. I don't know what I'm doing wrong, I just can't make it cancel out when it's on a bike, it goes on anyways. :/

Appreciate any help given, thanks.

I haven't scripted in quite a while, so don't blame me. :P
Reply
#2

Check if the player is inside a vehicle.
Reply
#3

It would probably be better if you used the "IsInvalidNosVehicle", as there are some non-motorbikes that crash when you add nos to them.
Reply
#4

Quote:
Originally Posted by Weirdosport
It would probably be better if you used the "IsInvalidNosVehicle", as there are some non-motorbikes that crash when you add nos to them.
I'll get to that later, but I don't understand why it STILL applies NOS to a bike.
Reply
#5

Because sa-mp doesn't have a inbuild function to stop it so it F*CKS up. So how about you just do IsInvalidNosVehicle. Also GTA:SA Didn't need the function no nos add onto bikes because there was no way to.
Reply
#6

Quote:
Originally Posted by [HiC
TheKiller ]
Because sa-mp doesn't have a inbuild function to stop it so it F*CKS up. So how about you just do IsInvalidNosVehicle. Also GTA:SA Didn't need the function no nos add onto bikes because there was no way to.
You mean sa-mp can't cancel out the callback? I should be able to break; / return 1; it and stop it successfully.

Edit: I can't find IsInvalidNosVehicle in the searchbar, can I get that code?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)