SA-MP Forums Archive
Problem with unlimmited nos reloads - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Problem with unlimmited nos reloads (/showthread.php?tid=337453)



Problem with unlimmited nos reloads - mave_man - 26.04.2012

Hi what I want is when a player runs out of nitro, he can press the fire key, and the nos gets reloaded.
This however doesn't work.
Does anyone of you guys see the mistake/error in here?
Код:
	public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) {
		if(newkeys == KEY_FIRE) {		
			if(pWorld[playerid] == WORLD_STUNT) {
				if(IsPlayerInAnyVehicle(playerid)) {
					AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
					SendClientMessage(playerid, -1, ""COL_GREY">> "COL_BLUE"SERVER "COL_GREY"<< "COL_WHITE"Your vehicle now has "COL_GREEN"NOS"COL_WHITE"!");
				}
			}
		}
		if(newkeys == KEY_FIRE && oldkeys == KEY_FIRE) {		
			if(pWorld[playerid] == WORLD_STUNT) {
				if(IsPlayerInAnyVehicle(playerid)) {
					AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
					SendClientMessage(playerid, -1, ""COL_GREY">> "COL_BLUE"SERVER "COL_GREY"<< "COL_WHITE"Your vehicle now has "COL_GREEN"NOS"COL_WHITE"!");
				}
			}
		}
		return true;
	}



Re: Problem with unlimmited nos reloads - SuperViper - 26.04.2012

Use the PAWN tags next time.

Instead of

pawn Код:
if(newkeys == KEY_FIRE)
and

pawn Код:
if(oldkeys == KEY_FIRE)
replace the equal signs with a single &.