Permission based off of player name?

Trying to work with any vehicle blacklist script to make it instead of having to use steamids it just checks if the playername has “CIV-1” or “CIV-2”, etc. Not sure what function or native does this.

(sorry if this is spanish to you, I don’t write in lua ;P) I may be wrong but I believe Player.Name returns a string of the players name.

Make a check for if the player is in a vehicle… If this returns true, get the vehicle of the ped (GetVehiclePedIsIn) then check if the vehicle the ped is in matches your specifed vehicles hash, then trigger a server event and pass your player to the server event, then on your serverside code check if the player name string (Player.Name) contains your keyword that you want in the players name for him to be able to use the vehicle, if so, make the server event trigger a client event, or, well, I would trigger a bool but I don’t know how that works in lua lol (if you use trigger the client event then only trigger this on the client that triggered the server event and not on everyone ;P) I suggest doing something inverted though, for example if your server event DOES trigger a client event, in the case that the player doesnt have the keyword in his name, then kick the player out of the vehicle, else, do nothing.

Well instead of listing out CIV-1, CIV-2, CIV-3, CIV-4, CIV-5 etc. You can do something like

if string.find(GetPlayerName(PlayerId()), "CIV-") then
   -- Pass
end

That should work gucci. A vehicle blacklist script you could use is

Is would need heaps of editing though.

2 Likes