Hell-Mate Posted March 8, 2014 Posted March 8, 2014 hello community i have problem in this code .. i will not post the whole script. --client GUIEditor.edit[1] = guiCreateEdit(116, 286, 149, 28, "", false, GUIEditor.window[1]) GUIEditor.button[1] = guiCreateButton(276, 278, 95, 46, "Buy wine", false, GUIEditor.window[1]) addEventHandler ( "onClientGUIClick", GUIEditor.button[1], function ( ) num = tonumber ( guiGetText ( GUIEditor.edit[1] ) ) if not num then return outputChatBox ( "Invalid number.", 255,0,0 ) elseif num > 50000 then return outputChatBox ( "Maximum time is 50000 (50 secs)", 255,0,0 ) end triggerServerEvent ( "onbuywine", localPlayer ) end) --server function drunk ( num ) setTimer ( removeElementData, num, 1, source, "drunk" ) setTimer ( setPedWalkingStyle, num, 1, source, 0 ) outputChatBox ( "Press alt to walk on drunk mode, you have " .. num .. " mili-seconds to be normal!",source,255,0,255, false ) end addEvent( "onbuywine", true ) addEventHandler( "onbuywine", root, drunk ) Errors/Warnings when pressing button : argument 2 ( got nil ) line 1 and 2 and attemp to concatenate a 'local' num ( a nil value ) some one help please
WhoAmI Posted March 8, 2014 Posted March 8, 2014 GUIEditor.edit[1] = guiCreateEdit(116, 286, 149, 28, "", false, GUIEditor.window[1]) GUIEditor.button[1] = guiCreateButton(276, 278, 95, 46, "Buy wine", false, GUIEditor.window[1]) addEventHandler ( "onClientGUIClick", GUIEditor.button[1], function ( ) num = tonumber ( guiGetText ( GUIEditor.edit[1] ) ) if not num then outputChatBox ( "Invalid number.", 255,0,0 ) return end if num > 50000 then outputChatBox ( "Maximum time is 50000 (50 secs)", 255,0,0 ) end triggerServerEvent ( "onbuywine", localPlayer, num ) end) And serverside looks fine.
Anubhav Posted March 8, 2014 Posted March 8, 2014 GUIEditor.edit[1] = guiCreateEdit(116, 286, 149, 28, "", false, GUIEditor.window[1]) GUIEditor.button[1] = guiCreateButton(276, 278, 95, 46, "Buy wine", false, GUIEditor.window[1]) addEventHandler ( "onClientGUIClick", GUIEditor.button[1], function ( ) num = tonumber ( GUIEditor.edit[1] ) if not num then outputChatBox ( "Invalid number.", 255,0,0 ) return elseif num > 50000 then return outputChatBox ( "Maximum time is 50000 (50 secs)", 255,0,0 ) end triggerServerEvent ( "onbuywine", localPlayer ) end) You used > instead of <. If you would use it will output it because it will be less.
Hell-Mate Posted March 8, 2014 Author Posted March 8, 2014 Thanks. i forget to add num to the trigger , thanks whoami
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