• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] Car jack/stealing detector.
#1
So I want to make an admin warning message if a player car jack/steal a vehicle that is being occupied by someone.



Is there a function to check if the vehicle is occupied? or maybe a function that would help me make this code.



If not, any idea that would help me?
  Reply
#2
This can help:



PHP Code:
IsVehicleOccupied(vehicleid)

{

? ? for(new 
GetPlayerPoolSize(); != -1i--)?

? ? ? ? if(
IsPlayerInVehicle(ivehicleid) && GetPlayerVehicleSeat(i) == 0)

? ? ? ? ? ? return 
1;



? ? return 
0;





can use foreach too.
  Reply
#3
There already is 'IsVehicleOccupied' native in YSF, use that one.

https://github.com/IllidanS4/YSF
daddy. /?daddyDOT





?

[Image: image.png]

  Reply
#4
(2021-07-22, 01:58 PM)daddy. Wrote: There already is 'IsVehicleOccupied' native in YSF, use that one.
https://github.com/IllidanS4/YSF
...which does the exact same thing with even more checks checks if player is either driver or passenger so they would need a extra check there :)

EDIT: But for some odd reason, YSF also has HasVehicleBeenOccupied which is much more efficient check as it does not run loops, wtf Illidan XD
EDIT 2: This actually might not work, wtf xD
Using Pawn.CMD?

If you're doing so, this is the very first sign that you absolutely shouldn't utilize your all powerful P-Code knowledge in any of the scripting discussion topics.
  Reply
#5
(2021-07-22, 09:13 PM)Pinch Wrote:
(2021-07-22, 01:58 PM)daddy. Wrote: There already is 'IsVehicleOccupied' native in YSF, use that one.

https://github.com/IllidanS4/YSF

...which does the exact same thing with even more checks checks if player is either driver or passenger so they would need a extra check there :)



True, fair enough to quote :D
daddy. /?daddyDOT





?

[Image: image.png]

  Reply


Forum Jump: