13.03.2010, 07:52
I'm trying to develop a bunnyhop button for motorbikes, and my code looks like this:
I noticed that the code never worked until I took out the MapAndreas_FindZ_For2DCoord line. At first I thought it was because the coord given by it wasn't EXACTLY the same as my ACTUAL position.
I also noticed that the messages I got in the console always gave me the same Z co-ord, regardless of how high i was above the ground. I set my height to 30000 over the abandoned airfield and got a Z co-ord of 27. This made Map Andreas ALWAYS return 1 as the z co-ord. I also tried to go above water, but that sent a console message telling me my Z co-ord was 0. It was trying to tell me that being 30000 units above the water had a Z co-ord of 0. :O
So I'm thinking that GetPlayerPos and GetVehiclePos BOTH get the height of the ground below you, NOT your ACTUAL height. Could I ask for someone to test my theory please?
pawn Код:
if((newkeys & 2048) && !(oldkeys & 2048)) //thats the special/turret up button, for motorbike bunnyhop
{
new vehicleid = GetPlayerVehicleID(playerid);
new modelid = GetVehicleModel(vehicleid);
if((modelid == 521) || (modelid == 522) || (modelid == 448) || (modelid == 523) || (modelid == 586) || (modelid == 581) || (modelid == 468) || (modelid == 463) || (modelid == 432) || (modelid == 431) || (modelid == 462))
{
new Float:posx, Float:posy, Float:posz;
GetPlayerPos(playerid,posx,posy,posz);
new Float:debugZ = MapAndreas_FindZ_For2DCoord(posx,posy,posz);//debug
printf("Current Pos: %f X, %f Y, %f Z",posx,posy,posz);//debug
printf("Map andreas co ord: %f Z",debugZ);//debug
if(MapAndreas_FindZ_For2DCoord(posx,posy,posz) == posz)
{
new Float:x, Float:y, Float:z;
GetVehicleVelocity(vehicleid,x,y,z);
SetVehicleVelocity(vehicleid,x,y,z+0.2);
return 1;
}
return 1;
}
}
I also noticed that the messages I got in the console always gave me the same Z co-ord, regardless of how high i was above the ground. I set my height to 30000 over the abandoned airfield and got a Z co-ord of 27. This made Map Andreas ALWAYS return 1 as the z co-ord. I also tried to go above water, but that sent a console message telling me my Z co-ord was 0. It was trying to tell me that being 30000 units above the water had a Z co-ord of 0. :O
So I'm thinking that GetPlayerPos and GetVehiclePos BOTH get the height of the ground below you, NOT your ACTUAL height. Could I ask for someone to test my theory please?