Problem with jail in native UI menu

Hello, Im working on a staff menu and I have created an item that sends someone to jail. The thing is that when I send someone to jail even If I put a wrong ID it sends always me for 0 minutes and nothing is written in the chat like ( ~~~ has been jailed for the reason : Read Rules ) . I dont know why this happens. I get this error in console :

Any suggestion?
My code with the jail thing is this : Staff Menu Jail - Pastebin ( I also want to give credits to qalle-git for their release of esx-qalle-jail )
Thank you!
Kind regards,
Lefos

Remove tonumber from the reason
the first two arguments are supposed to be int , the reason should be string because it contains words and numbers together.
int is only meant for numbers (1)
string is meant for words and sentences ( it should be in ’ ’ or " " )
float is like a decimal number (1.1)

1 Like
    jailtime = tonumber(jailtime)
    playerId = tonumber(playerId)
    TriggerEvent("esx-qalle-jail:jailPlayer", playerId , jailtime , reason)

tonumber will convert a string to int.
you are already converting them once. no need to converting them again when sending the event itself

and also in line 4 of your code. you are sending a useless argument.

JailPlayer(GetPlayerServerId(playerId))

you do not need to send the server id because you are getting it in the function.

1 Like