SA-MP Forums Archive
what is the id on sprint? - 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: what is the id on sprint? (/showthread.php?tid=460175)



what is the id on sprint? - SwisherSweet - 27.08.2013

what is the id on the sprint button?


Re: what is the id on sprint? - Dragonsaurus - 27.08.2013

You mean Key ID? It is KEY_SPRINT...


Re: what is the id on sprint? - SwisherSweet - 27.08.2013

yea, thanks also one more thing so i have this

Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if((newkeys & KEY_SPRINT)
    {
		if(IsPlayerInAnyVehicle(playerid)}
		{
		    ModifyVehicleSpeed(-1);
		}
	}
	return 1;
}




stock ModifyVehicleSpeed(mph)
{
	new Float:Vx,Float:Vy,Float:Vz,Float:DV,Float:multiple;
	for( new c = 1; c <= MAX_VEHICLES; c ++ )
	{
		GetVehicleVelocity(c,Vx,Vy,Vz);
		DV = floatsqroot(Vx*Vx + Vy*Vy + Vz*Vz);
		if(DV > 0)
		{
			multiple = ((mph + DV * 100) / (DV * 100));
			return SetVehicleVelocity(c,Vx*multiple,Vy*multiple,Vz*multiple);
		}
	}
	return 0;
}
and i have these errors

Код:
C:\Users\Andrei\Desktop\Andrei\zPlague -v2-\filterscripts\slowmotion.pwn(174) : error 029: invalid expression, assumed zero
C:\Users\Andrei\Desktop\Andrei\zPlague -v2-\filterscripts\slowmotion.pwn(175) : error 001: expected token: ")", but found "}"
C:\Users\Andrei\Desktop\Andrei\zPlague -v2-\filterscripts\slowmotion.pwn(175) : error 029: invalid expression, assumed zero
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
can you please explain what i was doing wrong?


Re: what is the id on sprint? - Finn707 - 27.08.2013

Could you specify some line numbers on the script?


Re: what is the id on sprint? - Dragonsaurus - 27.08.2013

Edit: Nvm, Finn already posted my question.


Re: what is the id on sprint? - SwisherSweet - 27.08.2013

Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if((newkeys & KEY_SPRINT)
    {//line...
		if(IsPlayerInAnyVehicle(playerid))
		{
		    ModifyVehicleSpeed(-1);
		}
	}
	return 1;
}
i fixed other errors

Код:
C:\Users\Andrei\Desktop\Andrei\zPlague -v2-\filterscripts\slowmotion.pwn(169) : error 029: invalid expression, assumed zero
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.



Re: what is the id on sprint? - Dragonsaurus - 27.08.2013

Additional bracket at (newkeys & KEY_SPPRINT), remove one of them before newkeys.
Also at this line you have a brace "}" instead of a bracket ")":
pawn Код:
if(IsPlayerInAnyVehicle(playerid)}



Re: what is the id on sprint? - JimmyCh - 27.08.2013

pawn Код:
if(newkeys & KEY_SPRINT)
Instead of:
pawn Код:
if((newkeys & KEY_SPRINT)