SA-MP Forums Archive
Getting player need? - 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)
+--- Thread: Getting player need? (/showthread.php?tid=615145)



Getting player need? - javedali1211 - 18.08.2016

hello everyone i wanted to ask you a system like i have join the server and my name is Alex and my ID is 0 i want to make a system if i lock a vehicle and other players when try to steal my vehicle they should get a message with my name like This vehicle is locked by Alex(0) you cant enter it and when i unlock my vehicle and when any other named player lock it then it should say his name and his id that is locked by bla bla bla i don't know how should i store player names and how to update them on every lock and how to show them so please explain me plz ?


Re: Getting player need? - javedali1211 - 18.08.2016

any one?


Re: Getting player need? - iLearner - 18.08.2016

When the player leaves, car will still be locked on his name? Or be free?


Re: Getting player need? - Sew_Sumi - 18.08.2016

https://sampforum.blast.hk/showthread.php?tid=370677

Really it's not hard to search for some things...

You can set the message to be displayed when OnPlayerEnterVehicle is called. When a person /locks a car you can tell them that it is locked by a player.

You could do a LockedBy[MAX_VEHICLES] array, which could store the ID of the player who last locked it, But by using MAX_VEHICLES though, you won't be using the array efficiently, and there will be excess empty cells.

You could use a LastLockedCar[MAX_PLAYERS], which could store the ID of the vehicle they had last locked, and being that it's 500 Vs the 2000 vehicles, it'll be lighter.

Then you'd just need a for loop to check each player, if the vehicle that the person who tried entering the car, is locked, reporting who it is that has "ownership" over the car.


Re: Getting player need? - javedali1211 - 18.08.2016

could you explain me more plzz.?