Is this nessesary? - 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: Is this nessesary? (
/showthread.php?tid=263328)
Is this nessesary? -
euRo - 21.06.2011
Quote:
forward RemoveDriverFromVehicle(playerid);
public RemoveDriverFromVehicle(playerid)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
RemovePlayerFromVehicle(playerid);
TogglePlayerControllable(playerid, 1);
return 1;
}
return 0;
}
if (newkeys & KEY_SECONDARY_ATTACK)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
RemoveDriverFromVehicle(playerid);
TogglePlayerControllable(playerid, 1);
return 1; //<--------- is this nessesary ?
}
}
|
"the return 1; above?
Re: Is this nessesary? -
PCheriyan007 - 21.06.2011
Well as long as you don't want to have strange bugs, then yes.
Re: Is this nessesary? -
Donya - 21.06.2011
pawn Код:
if (newkeys & KEY_SECONDARY_ATTACK)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
RemovePlayerFromVehicle(playerid);
TogglePlayerControllable(playerid, 1);
}
}
return 1 is not exactly needed there, and why are you doing the same thing 2 times?
if u want more code in key_secondary attack, then return 1 might be needed
Re: Is this nessesary? -
euRo - 21.06.2011
So do i remove return 1; or doesn't it matter
Re: Is this nessesary? -
PCheriyan007 - 21.06.2011
Why not just
pawn Код:
OnPlayerEnterVehicle(playerid, vehicleid)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
RemovePlayerFromVehicle(playerid);
}
// other stuff
return 1;
}
Re: Is this nessesary? -
Donya - 21.06.2011
KEY_SECONDARY_ATTACK is exiting a vehicle, and onplayerentervehicle is actually called when a player attempts to enter a vehicle
just put the code i gave you
why are u even using that code? that code is already gta-sided... are u trying to make as soon as u click enter it puts u out of the vehicle?
Re: Is this nessesary? -
euRo - 21.06.2011
yes to exit
Re: Is this nessesary? -
Donya - 21.06.2011
just click enter.. its gta hard coded already-.-