Adding a variable to "SetVehicleVelocity" - 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: Adding a variable to "SetVehicleVelocity" (
/showthread.php?tid=206896)
Adding a variable to "SetVehicleVelocity" -
linuxthefish - 04.01.2011
I am trying to make a command to change a vehicle's velocity. at the moment i am using
Код:
new Float:pX,Float:pY,Float:pZ;
new viv;
new tmp5[MAX_PLAYERS];
viv = GetPlayerVehicleID(pid);
GetVehicleVelocity(viv, pX, pY, pZ);
SetVehicleVelocity(viv, pX, pY, pZ +tmp5[pid]);
which compiles fine, but dosnt do anything when i use the command.
when i use
Код:
new Float:pX,Float:pY,Float:pZ;
new viv;
new tmp5[MAX_PLAYERS];
viv = GetPlayerVehicleID(pid);
GetVehicleVelocity(viv, pX, pY, pZ);
SetVehicleVelocity(viv, pX, pY, pZ +5);
which also compiles fine, but when i use the command it increses the players velocity on the Z by 5.
Can someone tell me what im doing wrong? Thanks.
Re: Adding a variable to "SetVehicleVelocity" -
Retardedwolf - 04.01.2011
Hm I think it should be
SetVehicleVelocity ( vix, pX, pY, pZ * 5 );
Re: Adding a variable to "SetVehicleVelocity" -
John_F - 04.01.2011
Isn't the Zvelocity how fast a player is moving UP? If that's what you're trying to do then kk, but if not then you're modifying the wrong axis's velocity.
Also, a variable for the player's vehicle seems redundant, as you're only using it once.
Just do:
pawn Код:
new Float:pX,Float:pY,Float:pZ;
new tmp5[MAX_PLAYERS];
GetVehicleVelocity(GetPlayerVehicleID(pid), pX, pY, pZ);
SetVehicleVelocity(GetPlayerVehicleID(pid), pX, pY, pZ*5);
Note that this script will increase the speed at which the player is moving upwards 5times the "up speed" they are currently at, meaning it will NOT make them move forward faster, which is probably why you think it's not working.
Re: Adding a variable to "SetVehicleVelocity" -
linuxthefish - 04.01.2011
Quote:
Also, a variable for the player's vehicle seems redundant, as you're only using it once.
|
Wow, i just fealised that! Thanks! I was using the vrong variable, tmp5 should't even be there! And btw, its a command to launch a players vehicle a set ammount into the air
Re: Adding a variable to "SetVehicleVelocity" -
John_F - 04.01.2011
Then use + NOT *.