ThePhill97 Posted January 7, 2013 Posted January 7, 2013 I know the simplicity of this function, but it just doesn't work. givePlayerMoney ( thePlayer, amount ) local accountAdded = addAccount(tostring(username),tostring(password)) if (accountAdded) then outputChatBox ("#FF0000* #00FF00You have sucessfuly registered! [username: #FFFFFF" .. username .. " #00FF00| Password: #FFFFFF" .. password .. "#00FF00 ]",source,255,255,255,true ) outputChatBox("You travelled to 'Philatopia' from *BLANK*.", source) outputChatBox("Your left-over cash = $500.", source) givePlayerMoney ( thePlayer, 500 ) What is the problem? givePlayerMoney is the correct thing, give it to the player, $500... [NOTE] It's abit scrunched up, but I have the correct dents everywhere on my file.
ThePhill97 Posted January 7, 2013 Author Posted January 7, 2013 What's the full function? & events? function registerPlayer(username,password,passwordConfirm) if not (username == "") then if not (password == "") then if not (passwordConfirm == "") then if password == passwordConfirm then local account = getAccount (username,password) if (account == false) then local accountAdded = addAccount(tostring(username),tostring(password)) if (accountAdded) then outputChatBox ("#FF0000* #00FF00You have sucessfuly registered! [username: #FFFFFF" .. username .. " #00FF00| Password: #FFFFFF" .. password .. "#00FF00 ]",source,255,255,255,true ) outputChatBox("You travelled to 'Philatopia' from *BLANK*.", source) outputChatBox("Your left-over cash = $500.", source) givePlayerMoney ( thePlayer, 500 ) else triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","Error ocurred. Choose a different username/password.") end else triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","An account with this username already exists") end else triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","Passwords do not match") end else triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","Please confirm your password") end else triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","Please enter a password") end else triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","Please enter a username you would like to register") end end addEvent("onRequestRegister",true) addEventHandler("onRequestRegister",getRootElement(),registerPlayer) The script itself works, just not money giving?
novo Posted January 7, 2013 Posted January 7, 2013 Where's the function that triggers addEvent("onRequestRegister",true) ? ..
ThePhill97 Posted January 7, 2013 Author Posted January 7, 2013 This one?: function onClickBtnRegister(button,state) --При нажатии на кнопку Register and Cofirm if(button == "left" and state == "up") then if (source == btn_reg_tab_register) then username = guiGetText(edit_account_name) password = guiGetText(edit__reg_tab_password) passwordConfirm = guiGetText(edit__reg_tab_Repassword) triggerServerEvent("onRequestRegister",getLocalPlayer(),username,password,passwordConfirm) end end end
novo Posted January 7, 2013 Posted January 7, 2013 function onClickBtnRegister(button,state) --При нажатии на кнопку Register and Cofirm if(button == "left" and state == "up") then if (source == btn_reg_tab_register) then username = guiGetText(edit_account_name) password = guiGetText(edit__reg_tab_password) passwordConfirm = guiGetText(edit__reg_tab_Repassword) triggerServerEvent(getLocalPlayer(), "onRequestRegister",getLocalPlayer(),username,password,passwordConfirm,getLocalPlayer()) end end end function registerPlayer(username,password,passwordConfirm,thePlayer) if not (username == "") then if not (password == "") then if not (passwordConfirm == "") then if password == passwordConfirm then local account = getAccount (username,password) if (account == false) then local accountAdded = addAccount(tostring(username),tostring(password)) if (accountAdded) then outputChatBox ("#FF0000* #00FF00You have sucessfuly registered! [username: #FFFFFF" .. username .. " #00FF00| Password: #FFFFFF" .. password .. "#00FF00 ]",source,255,255,255,true ) outputChatBox("You travelled to 'Philatopia' from *BLANK*.", source) outputChatBox("Your left-over cash = $500.", source) givePlayerMoney ( thePlayer, 500 ) else triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","Error ocurred. Choose a different username/password.") end else triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","An account with this username already exists") end else triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","Passwords do not match") end else triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","Please confirm your password") end else triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","Please enter a password") end else triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","Please enter a username you would like to register") end end addEvent("onRequestRegister",true) addEventHandler("onRequestRegister",getRootElement(),registerPlayer)
ThePhill97 Posted January 7, 2013 Author Posted January 7, 2013 function onClickBtnRegister(button,state) --При нажатии на кнопку Register and Cofirm if(button == "left" and state == "up") then if (source == btn_reg_tab_register) then username = guiGetText(edit_account_name) password = guiGetText(edit__reg_tab_password) passwordConfirm = guiGetText(edit__reg_tab_Repassword) triggerServerEvent(getLocalPlayer(), "onRequestRegister",getLocalPlayer(),username,password,passwordConfirm,getLocalPlayer()) end end end function registerPlayer(username,password,passwordConfirm,thePlayer) if not (username == "") then if not (password == "") then if not (passwordConfirm == "") then if password == passwordConfirm then local account = getAccount (username,password) if (account == false) then local accountAdded = addAccount(tostring(username),tostring(password)) if (accountAdded) then outputChatBox ("#FF0000* #00FF00You have sucessfuly registered! [username: #FFFFFF" .. username .. " #00FF00| Password: #FFFFFF" .. password .. "#00FF00 ]",source,255,255,255,true ) outputChatBox("You travelled to 'Philatopia' from *BLANK*.", source) outputChatBox("Your left-over cash = $500.", source) givePlayerMoney ( thePlayer, 500 ) else triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","Error ocurred. Choose a different username/password.") end else triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","An account with this username already exists") end else triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","Passwords do not match") end else triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","Please confirm your password") end else triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","Please enter a password") end else triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","Please enter a username you would like to register") end end addEvent("onRequestRegister",true) addEventHandler("onRequestRegister",getRootElement(),registerPlayer) Now the player cannot register. Nothing happens.
novo Posted January 7, 2013 Posted January 7, 2013 function onClickBtnRegister(button,state) --При нажатии на кнопку Register and Cofirm if(button == "left" and state == "up") then if (source == btn_reg_tab_register) then username = guiGetText(edit_account_name) password = guiGetText(edit__reg_tab_password) passwordConfirm = guiGetText(edit__reg_tab_Repassword) triggerServerEvent("onRequestRegister",getLocalPlayer(),username,password,passwordConfirm,getLocalPlayer()) end end end
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now