Please help me whith this.. - 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: Please help me whith this.. (
/showthread.php?tid=154345)
Please help me whith this.. -
Abraham2nd - 13.06.2010
ok I added a velocity to cars and well it makes the car faster and also makes it jump 10ft in the air all that works is the jump
i did get 2 warnings :
Код:
#include <a_samp>
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
new Tick[MAX_PLAYERS];
OnPlayerUpdate(playerid)
{
Tick[playerid]++;
if(Tick[playerid] != 3) return 1;
Tick[playerid] = 0;
new Keys,up,down;
GetPlayerKeys(playerid,Keys,up,down);
new Float:x,Float:y,Float:z;
if(Keys &= 1024)
{
if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
{
GetPlayerVelocity(playerid,x,y,z);
SetPlayerVelocity(playerid,x*1.2,y*1.2,z*1.2);
}
}
else if(Keys &= 4)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
GetVehicleVelocity(GetPlayerVehicleID(playerid),x,y,z);
SetVehicleVelocity(GetPlayerVehicleID(playerid),x*1.2,y*1.2,z*1.2);
}
}
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (PRESSED(KEY_HANDBRAKE)) // Change KEY_HANDBRAKE to your choice of PlayerKeys
{
new Float:x, Float:y, Float:z;
GetVehicleVelocity(GetPlayerVehicleID(playerid), x, y, z);
SetVehicleVelocity(GetPlayerVehicleID(playerid) ,x ,y ,z+0.3);
}
return 1;
}
and this is all that is in the filterscript:
Код:
#include <a_samp>
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
new Tick[MAX_PLAYERS];
OnPlayerUpdate(playerid)
{
Tick[playerid]++;
if(Tick[playerid] != 3) return 1;
Tick[playerid] = 0;
new Keys,up,down;
GetPlayerKeys(playerid,Keys,up,down);
new Float:x,Float:y,Float:z;
if(Keys &= 1024)
{
if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
{
GetPlayerVelocity(playerid,x,y,z);
SetPlayerVelocity(playerid,x*1.2,y*1.2,z*1.2);
}
}
else if(Keys &= 4)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
GetVehicleVelocity(GetPlayerVehicleID(playerid),x,y,z);
SetVehicleVelocity(GetPlayerVehicleID(playerid),x*1.2,y*1.2,z*1.2);
}
}
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (PRESSED(KEY_HANDBRAKE)) // Change KEY_HANDBRAKE to your choice of PlayerKeys
{
new Float:x, Float:y, Float:z;
GetVehicleVelocity(GetPlayerVehicleID(playerid), x, y, z);
SetVehicleVelocity(GetPlayerVehicleID(playerid) ,x ,y ,z+0.3);
}
return 1;
}