Run commands only if player is a certain ped

Hello everyone.

I’ll start off by saying that LUA coding is not my strong suit.

I’m looking for some pointers on making a check to see if someone is a certain ped skin before they are allowed to enter a command.

I have a /revive command on my server. I would like only fire and ems peds be allowed to enter in the /revive command. I believe this is possible, as it seems fairly straightforward in my mind.

My first thought was having a nested if-then statement in the /revive command’s resource.

Something like: IF ped = EMS-PED, THEN set revive = true.
And make the /revive command work only if the revive is set to true.
No idea, really.

I never did take time to learn LUA, maybe someone could point me in the right direction.

Thank you for taking your time to read my nonsense.

-Matt

Im sure there is a way to do this.
The easiest way is to find another resource that uses the PEDS for white listing of actions. I know there is a PTTRadio script somewhere on the forums that uses the current ped to allow putting the hand on gun or radio animation. I would learn off that and make some thing nice, since the hard part prolly is the white listing of a event based off the ped.

But if you don’t mind i am kinda curious why go through all that when you could use ESX or Vrp and have a full on job system. Thats pretty much a one click install?

I never did think of that. I even have the PTTRadio script. Thanks a whole bunch.

The reason I don’t use ESX or vRP is that I had the Police script for ESX, but it wouldn’t work right. I haven’t dabbled too far into vRP, but I believe it also is an economy based system, right?

My community isn’t too keen on moving to economy, maybe sometime.

Ahh i would give ESX a second go its really nice. You can edit all items in the data base to be free. So you could just add a bunch of really nice stuff in the server for fun and keep to the ways every one is use to.
As far as the police system yeah it can be tricky but to be honest thats why i use this

Its super easy to set up and by using this you would be able to let officers have esx jobs as well as be a cop.





This way you dont have to reinvent the wheel.

Yeah, that’s the same script I use for the police jobs. For some reason whenever I use a command to add, say ID 2 to Sheriff, it adds me to Sheriff instead, and I’m ID 1. It’s odd.

Question when you tried to add a new user did you format it

/copadd serverusernumber
then
/copdept serverusernumber 2 (for the sheriffs office)

then
/coprank serverusernumber and rank number from

?

Yes. I used:

/copadd 2 - For my friend

/copdept 2 2 - Sheriff

/coprank 2 26 - For the Sheriff

After this it allowed me to go on duty using the Sheriff ped and he only had the “Clock out” option.

Ahhh did you try to relog after getting just the blank menu? I noticed when i add a new user to the database they have to relog fully for the changes to take effect.
Also
I only use the admin rank to assign users to rank in depts then i use a normal rank for rp so i have access to just my depts features. So when i need to switch my rank around for permissions i use hedi and edit my rank in the sql table
image

Ooohhhh, ok. Thank you so much, sincerely. I’ll start from scratch and see if I can wrap my brain around it with some testing and such. Again, thanks.

No problem good luck with it, Shoot me a message if you need any help im not hard to find. And i had to break my brain figuring it out on my own lol.

1 Like