Vehicle Hopping - 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: Vehicle Hopping (
/showthread.php?tid=146036)
Vehicle Hopping -
Bomber - 05.05.2010
So, i have this code:
pawn Код:
if (IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if (newkeys & KEY_CROUCH)
{
new Float:xx, Float:xy, Float:xz;
GetVehicleVelocity(GetPlayerVehicleID(playerid), xx, xy, xz);
SetVehicleVelocity(GetPlayerVehicleID(playerid), xx, xy, xz + sf);
return 1;
}
}
How can i make a command what disabled/enables it ?
Re: Vehicle Hopping -
Bomber - 05.05.2010
Sorry for double post, but i need help !
Re: Vehicle Hopping -
¤Adas¤ - 05.05.2010
OMG, just use variable!
Re: Vehicle Hopping -
Bomber - 05.05.2010
How ?
Re: Vehicle Hopping -
boelie - 05.05.2010
You can make a variable between the functions
For example here only admins can do this..
Код:
if (IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(isplayeradmin(playerid)
{
if (newkeys & KEY_CROUCH)
{
new Float:xx, Float:xy, Float:xz;
GetVehicleVelocity(GetPlayerVehicleID(playerid), xx, xy, xz);
SetVehicleVelocity(GetPlayerVehicleID(playerid), xx, xy, xz + sf);
}
}
return 1;
}
I suggest you try out the new setvparint function here to make your own 'variable'
https://sampwiki.blast.hk/wiki/SetPVarInt
Re: Vehicle Hopping -
Calgon - 05.05.2010
pawn Код:
if (IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if (newkeys & KEY_CROUCH)
{
if( GetPVarInt( playerid, "Hop" ) >= 1 )
{
new Float:xx, Float:xy, Float:xz;
GetVehicleVelocity(GetPlayerVehicleID(playerid), xx, xy, xz);
SetVehicleVelocity(GetPlayerVehicleID(playerid), xx, xy, xz + sf);
return 1;
}
}
}
Then create a command:
pawn Код:
if( GetPVarInt( playerid, "Hop" ) >= 1 )
{
SetPVarInt( playerid, "Hop", 0 );
}
else
{
SetPVarInt( playerid, "Hop", 1 );
}
Re: Vehicle Hopping -
Bomber - 05.05.2010
How i do this command ?
Like this ?
pawn Код:
if (strcmp("/jump", cmdtext, true) == 0)
{
if( GetPVarInt( playerid, "Hop" ) >= 1 )
{
SetPVarInt( playerid, "Hop", 0 );
}
else
{
SetPVarInt( playerid, "Hop", 1 );
}
return 1;
}
Re: Vehicle Hopping -
boelie - 05.05.2010
When you added the stuff the other guy posted make a command like this;
Код:
if (strcmp("/jump", cmdtext, true) == 0)
{
if( GetPVarInt( playerid, "Hop" ) >= 1 )
{
if (IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if (newkeys & KEY_CROUCH)
{
new Float:xx, Float:xy, Float:xz;
GetVehicleVelocity(GetPlayerVehicleID(playerid), xx, xy, xz);
SetVehicleVelocity(GetPlayerVehicleID(playerid), xx, xy, xz + sf);
}
}
}
return 1;
}