Adding a variable to "SetVehicleVelocity"
#1

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.
Reply
#2

Hm I think it should be

SetVehicleVelocity ( vix, pX, pY, pZ * 5 );
Reply
#3

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.
Reply
#4

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
Reply
#5

Then use + NOT *.
Reply


Forum Jump:


Users browsing this thread: