Homer Simpson

Error in my script

Recommended Posts

Hello, good day.

I have a problem whit a script. Im starting in the theme of scripting in MTA:SA and, well, if you can help me, i would really appreciate it.

Well the problem comes here (I use the gamemode of paradise)

That when I try to create another character, when putting age, nationality and stature always tells me Your minimum age can only be 18 years old.

I have, one more question, would it be possible that only specific nationalities can be written?

Thank you very much in case you answer and read this.


vMddRLe.jpegEZQjDky.jpeg Nombre = name.

Nombre = name

Edad = age

Nacionalidad = nationality

Altura en cm = height in cm

crear = create

cancelar = cancel


--- /gui/verify/create_character.Lua

function verifyEdad( edad )
	if not edad then -- edad = age
		return "No has una edad." -- you didn´t put any age
	elseif #edad < 18 then
		return "Tu edad minima solo puede ser de 18 años." -- Your minium age can be only 18 years
	elseif #edad >= 99 then
		return "Tu edad maxima solo puede ser 99 años." -- your maxium age can be only 99 years
	elseif tonumber(text) then
		return "No puedes usar letras" -- You can´t use any letters
	elseif foundSpace then
		return "No puedes usar espacios" -- You can´t use any backspace

function verifyNacionalidad( nacionalidad )
	if not nacionalidad then -- nacionalidad = nationality
		return "No has puesto una nacionalidad" -- You didn´t put any nationality
	elseif not tonumber(text) then
		return "No tienes ninguna letra escrita" -- You didn´t write any letter
	elseif nacionalidad and type(nacionalidad) == "number" then  -- You can´t use any number
		return "No puedes usar numeros"

function verifyEstatura( estatura )
	if not estatura then -- estatura = height
		return "No has una estatura." -- You didn´t write any height
	elseif #estatura >= 200 then
		return "Tu estatura maxima solo puede ser de 200 CM." -- Your maxium height can be only 200CM
	elseif #estatura < 140 then 
		return "Tu estatura minima solo puede ser de 140 CM." -- Your minium height can be only 140CM
	elseif tonumber(text) then
		return "No puedes usar letras" -- You can´t use any letters
	elseif foundSpace then
		return "No puedes usar espacios" -- You can´t put spaces

--- /gui/windows/create_character.Lua

local function tryCreate( key )
	local name = destroy["g:createcharacter:name"] and guiGetText( destroy["g:createcharacter:name"] )
	local edad = destroy["g:createcharacter:edad"] and guiGetText( destroy["g:createcharacter:edad"] )
	local nacionalidad = destroy["g:createcharacter:nacionalidad"] and guiGetText( destroy["g:createcharacter:nacionalidad"] )
	local estatura = destroy["g:createcharacter:estatura"] and guiGetText( destroy["g:createcharacter:estatura"] )
	local error = verifyCharacterName( name ) or verifySkin( selectedSkin ) or verifyEdad( edad ) or verifyNacionalidad( nacionalidad ) or verifyEstatura( estatura )
	if not error then
		triggerServerEvent( "gui:createCharacter", getLocalPlayer( ), name, selectedSkin, edad, nacionalidad, estatura )
		setMessage( error )


Sorry for my bad english.

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.