SA-MP Forums Archive
anti-car stealing. - 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: anti-car stealing. (/showthread.php?tid=267259)



anti-car stealing. - budelis - 07.07.2011

Hi people.I need that thing,if any player sit in any vehicle and other player wanna to drop player from vehicle,he get stopped and will get message "Please don't steal a car".


Re: anti-car stealing. - Cyanide - 07.07.2011

You can request a script here.


Re: anti-car stealing. - Scenario - 07.07.2011

You can try using this function. Otherwise, try searching for what you need.


Re: anti-car stealing. - Hipflop - 07.07.2011

You can try to use Player States.

More to read about them:
https://sampwiki.blast.hk/wiki/GetPlayerState

For example: (this goes under OnPlayerStateChange callback)

pawn Код:
if(GetPlayerState(playerid) == 5)
{
  // execute your code
}
Number 5 stands for the state "Player enters vehicle as driver".
More to read about them in the link above.


Re: anti-car stealing. - budelis - 07.07.2011

Yes,i try to do with getplayerstate but it worst.Maybe you can help my how it have be started?


Re: anti-car stealing. - Scenario - 07.07.2011

Quote:
Originally Posted by Hipflop
Посмотреть сообщение
You can try to use Player States.

More to read about them:
https://sampwiki.blast.hk/wiki/GetPlayerState
It would be much faster using the function I mentioned, "SetVehicleParamsForPlayer()."


Re: anti-car stealing. - Hipflop - 07.07.2011

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
It would be much faster using the function I mentioned, "SetVehicleParamsForPlayer()."
I don't think so, because then you have to loop through all the cars that are spawned. It only slowers the script.


Re: anti-car stealing. - Hipflop - 07.07.2011

First of all, you need to check if there is someone in the car you want to enter.
If that is true, you need to send a message with the "Don't steal a car" or something like that.

If it is false, you just enter the vehicle.


Re: anti-car stealing. - Scenario - 07.07.2011

Quote:
Originally Posted by Hipflop
Посмотреть сообщение
I don't think so, because then you have to loop through all the cars that are spawned. It only slowers the script.
You could always use "foreach" by "******" for the loop. It would be a lot more accurate compared to relying on a player state to do this.


Re: anti-car stealing. - Hipflop - 07.07.2011

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
You could always use "foreach" by "******" for the loop. It would be a lot more accurate compared to relying on a player state to do this.
There you are right, but I don't think he will understand that.