SetPlayerVelocity - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: SetPlayerVelocity (
/showthread.php?tid=178853)
SetPlayerVelocity -
Bessensap - 24.09.2010
Hey, im making a script which sets ur velocity to a certain amount, but the z part wont work, ive tried a lot of ways, but if i set 50 or 5 at the vz
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys == KEY_SECONDARY_ATTACK)
{
new vx,vy,vz;
GetPlayerVelocity(playerid,Float:vx,Float:vy,Float:vz);
SetPlayerVelocity(playerid,vx + 0.5,vy - 0.7 ,vz + 0.5);
}
Re: SetPlayerVelocity -
CAR - 24.09.2010
Must be
pawn Код:
new Float:vx,Float:vy,Float:vz;
Don't know why Z isn't working...
Re: SetPlayerVelocity -
Mauzen - 24.09.2010
You have to init the variables as Floats, meaning, add the Float: tag in front of the variables already in the "new ..." line, not in the line when you get the velocity. Else they will just be integers, and they are not compatible with the velocity stuff.
pawn Код:
new Float:vx, Float:vy, Float:vz;
Re: SetPlayerVelocity -
Bessensap - 24.09.2010
@ Mauzen, the vx and the vy part works perfect.
Just not the Z
Re: SetPlayerVelocity -
Bessensap - 25.09.2010
Bump? Sorry just need a solution.
Re: SetPlayerVelocity -
The_Moddler - 25.09.2010
Just put
new Float:vx, Float:vy, Float:vz;
Re: SetPlayerVelocity -
[XST]O_x - 25.09.2010
pawn Код:
if(newkeys == KEY_SECONDARY_ATTACK)
{
new Float:vx,Float:vy,Float:vz;
GetPlayerVelocity(playerid,vx,vy,vz);
SetPlayerVelocity(playerid,vx + 0.5,vy - 0.7 ,vz + 0.5);
}