How to /flip using the alt key? -
ThePS3Guy - 06.08.2009
Hi I am creating a lan server but I am relatively new to Pawno so if you can be specific with this one that would help a lot. But anyways I searched up my question and it seems very easy to make your car flip using /flip but I am looking for a way to make it flip using the alt key. I know it can be done because I've been in a couple of servers that do it that way. Thanks very much for your help.
Re: How to /flip using the alt key? -
[KML]Dabug - 06.08.2009
Im not sure but maybe rotate it 180?
Re: How to /flip using the alt key? -
ThePS3Guy - 06.08.2009
Thanks for the input. I know that aspect of it (generally... dont know how to code it) all I have to do for that part is reset z angle (im pretty sure). But the part I don't know is how to control it by using the alt key.
Re: How to /flip using the alt key? -
JaTochNietDan - 06.08.2009
You need to combine OnPlayerKeyStateChange and SetVehicleZAngle
Like so:
pawn Код:
public OnPlayerKeyStateChange(playerid,newkeys,oldkeys)
{
if(IsPlayerInAnyVehicle(playerid) && newkeys &= 4)
{
new Float:ZAngle;
GetVehicleZAngle(GetPlayerVehicleID(playerid),ZAngle);
SetVehicleZAngle(GetPlayerVehicleID(playerid),ZAngle);
}
return 1;
}
Re: How to /flip using the alt key? -
ThePS3Guy - 06.08.2009
Thanks I'll try that out and let you know how it goes
Re: How to /flip using the alt key? -
ThePS3Guy - 06.08.2009
After trying to compile I get this:
C:\Documents and Settings\Administrator\Desktop\sampserver\filtersc ripts\altflip.pwn(181) : error 022: must be lvalue (non-constant)
C:\Documents and Settings\Administrator\Desktop\sampserver\filtersc ripts\altflip.pwn(181) : warning 215: expression has no effect
C:\Documents and Settings\Administrator\Desktop\sampserver\filtersc ripts\altflip.pwn(181) : error 001: expected token: ";", but found ")"
C:\Documents and Settings\Administrator\Desktop\sampserver\filtersc ripts\altflip.pwn(181) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Administrator\Desktop\sampserver\filtersc ripts\altflip.pwn(181) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
4 Errors.
If I am not mistaken... it's a filterscript right? So to make a filterscript you uncomment the #define filterscript at the top... and that's all to turn it into a filterscript right?
Re: How to /flip using the alt key? -
JaTochNietDan - 06.08.2009
Sorry, that won't compile :P, this will work
pawn Код:
public OnPlayerKeyStateChange(playerid,newkeys,oldkeys)
{
if(IsPlayerInAnyVehicle(playerid))
{
if(newkeys &= 4)
{
new Float:ZAngle;
GetVehicleZAngle(GetPlayerVehicleID(playerid),ZAngle);
SetVehicleZAngle(GetPlayerVehicleID(playerid),ZAngle);
}
}
return 1;
}
Also, please don't
double-post, use the
edit button.
Re: How to /flip using the alt key? -
ThePS3Guy - 06.08.2009
Ok will use the edit button
Thanks sooo much for your help it helped a lot. But I have one last question, the alt works at resetting the z angle, but is it possible to also make them appear like, a foot above where they were? Because when the angle alone is repositioned it tends to glitch up in certain spots form what I've found on other servers... so I think that making them appear I tiny bit higher so they don't appear half way in the ground would fix it.
its not exactly like resetting the z axis, more like adding on a bit, which is something I have no idea how to do.
Re: How to /flip using the alt key? -
JaTochNietDan - 06.08.2009
Indeed, simply do similiar but add on to the Z co-ordinates
pawn Код:
public OnPlayerKeyStateChange(playerid,newkeys,oldkeys)
{
if(IsPlayerInAnyVehicle(playerid))
{
if(newkeys &= 4)
{
new Float:ZAngle,Float:X,Float:Y,Float:Z,vehicleid;
vehicleid = GetPlayerVehicleID(playerid);
GetVehiclePos(vehicleid,X,Y,Z);
GetVehicleZAngle(vehicleid,ZAngle);
SetVehicleZAngle(vehicleid,ZAngle);
SetVehiclePos(vehicleid,X,Y,Z+2);
}
}
return 1;
}
Since we are using GetPlayerVehicleID(playerid); so much, I've used it just once in the script and stored it in a variable for use instead of calling it every time
Re: How to /flip using the alt key? -
ThePS3Guy - 06.08.2009
Thanks soo much for your help. Yesterday was my first day with pawno, so you can imagine how much it helps. I can read and edit it well enough already I think, but writing it is a different story. Thanks again.
For others who want to use it, for me, it compiles properly and seems to work in-game.