Red-Pitbull Posted March 9, 2014 Share Posted March 9, 2014 hi all guys this is phone script download from community i remove tab panel and create button i realy dont khow how to use this onClientGUIClick and where is use it ---client side--- sound = nil volume = 50 bindKey( "B", "down", "phone" ) -- Radio list local radio = { { "http://www.listenlive.eu/mixmegapol.m3u", "Mix megapol" }, { "http://stream-ice.mtgradio.com:8080/stat_bandit.m3u", "Bandit rock" }, { "http://www.listenlive.eu/nrj_se.m3u", "NRJ Sweden" }, { "http://sverigesradio.se/topsy/direkt/2576-hi-aac.pls", "Malmö (Hiphop/RnB)" }, { "http://scb2.fantis.se:8080/listen.pls", "Pirate rock" }, { "http://stream-ice.mtgradio.com:8080/stat_rix_fm.m3u", "Rix FM" }, { "http://www.listenlive.eu/rockklassiker.m3u", "Classical Rock" }, { "http://www.listenlive.eu/thevoice_se.m3u", "The voice" }, { "http://50.22.212.196:8132", "Underground radio" }, { "http://relay.181.fm:8068", "Old School Rap" }, { "http://tunein.t4e.dj/hard/dsl/mp3", "Techno4ever Hard stream" }, { "http://tunein.t4e.dj/club/dsl/mp3", "Techno4ever Clup stream" }, { "http://sj128.hnux.com/listen.pls", "Smooth Jazz" }, { "http://listen.di.fm/public3/clubdubstep.pls?a5e45b0f69e2910bde3edcd4", "Digitally Imported Big Room House" }, { "http://listen.di.fm/public3/club.pls?a5e45b0f69e2910bde3edcd4", "Digitally Imported Club Dubstep" }, { "http://listen.di.fm/public3/electro.pls?a5e45b0f69e2910bde3edcd4", "Digitally Imported Club Sounds" }, { "http://listen.di.fm/public3/electro.pls?a5e45b0f69e2910bde3edcd4", "Digitally Imported Electro House" }, { "http://listen.di.fm/public3/djmixes.pls?a5e45b0f69e2910bde3edcd4", "Digitally Imported DJ mixes" }, } local service = { "(911) Police", "(911) Ambulance", "(911) Fire Department", "Mechanic", "Taxi", "Pilot", "Bus Driver", "Fast food delivery", } -- Create window local x,y = guiGetScreenSize() local img = guiCreateStaticImage( 586, 178, 214, 422, ":nokialumia/lumia920.png", false) -- button for apps phone = guiCreateButton(17, 84, 46, 40, "Phone", false, GUIEditor.staticimage[1]) sms = guiCreateButton(63, 84, 46, 40, "sms", false, GUIEditor.staticimage[1]) radio = guiCreateButton(109, 84, 46, 40, "radio", false, GUIEditor.staticimage[1]) local playerList = guiCreateGridList( 0, 0.35, 1, 0.56, true, tabPlayers ) local smsTextBox = guiCreateMemo( 0, 0, 1, 0.34, "", true, tabPlayers ) local button3 = guiCreateButton( 0, 0.91, 1, 0.08, "Send SMS", true, tabPlayers ) local column = guiGridListAddColumn( playerList, "People", 0.85 ) if ( column ) then --If the column has been created, fill it with players for id, player in ipairs(getElementsByType("player")) do local row = guiGridListAddRow ( playerList ) guiGridListSetItemText ( playerList, row, column, getPlayerName ( player ), false, false ) end end local radioList = guiCreateGridList ( 0, 0, 1, 0.9, true, tabRadio ) local editBox = guiCreateEdit ( 0.67, 0.91, 0.15, 0.08, "50", true, tabRadio ) local button5 = guiCreateButton( 0.50, 0.91, 0.17, 0.08, "-", true, tabRadio ) local button4 = guiCreateButton( 0.82, 0.91, 0.17, 0.08, "+", true, tabRadio ) local column1 = guiGridListAddColumn( radioList, "Radio stations", 0.85 ) local button1 = guiCreateButton( 0.01, 0.91, 0.48, 0.08, "Stop", true, tabRadio ) local button2 = guiCreateButton( 0.33, 0.92, 0.34, 0.08, "X", true, img ) local button6 = guiCreateButton( 0, 0.92, 0.33, 0.08, "<", true, img ) guiSetAlpha( button2, 0 ) guiSetAlpha( button6, 0 ) if ( column ) then --If the column has been created, fill it with players for id, station in ipairs(radio) do local row = guiGridListAddRow ( radioList ) guiGridListSetItemText ( radioList, row, column1, radio[id][2], false, false ) end end local phoneList = guiCreateGridList ( 0, 0, 1, 0.9, true, tabPhone ) local column2 = guiGridListAddColumn( phoneList, "Call service", 0.9 ) local button7 = guiCreateButton( 0, 0.91, 1, 0.08, "Call service", true, tabPhone ) if ( column2 ) then for id, number in ipairs(service) do local row = guiGridListAddRow ( phoneList ) guiGridListSetItemText ( phoneList, row, column2, service[id], false, false ) end end -- Select radio station addEventHandler("onClientGUIDoubleClick",radioList, function() local row,col = guiGridListGetSelectedItem( radioList ) if isElement( sound ) then destroyElement ( sound ) end sound = playSound( radio[row+1][1] ) setSoundVolume( sound, tonumber( guiGetText ( editBox ))/100 ) -- Turn off the car radio setRadioChannel ( 0 ) end) -- Window properties guiWindowSetMovable ( phoneGui, false ) guiWindowSetSizable ( phoneGui, false ) -- Set the alpha guiSetAlpha ( phoneGui, 1 ) guiSetVisible( phoneGui, false ) -- Show/hide the phone updateTimer = { } function togglePhone( source ) -- Show the phone if not guiGetVisible( phoneGui ) then showCursor ( true ) guiSetVisible( phoneGui, true ) -- Update player list if ( column ) then -- Save selected item local row,col = guiGridListGetSelectedItem( playerList ) guiGridListClear ( playerList ) for id, player in ipairs(getElementsByType("player")) do local row = guiGridListAddRow ( playerList ) guiGridListSetItemText ( playerList, row, column, getPlayerName ( player ), false, false ) end -- Correct after refresh guiGridListSetSelectedItem( playerList, row, col ) end updateTimer[localPlayer] = setTimer( function() -- Update player list if ( column ) then -- Save selected item local row,col = guiGridListGetSelectedItem( playerList ) guiGridListClear ( playerList ) for id, player in ipairs(getElementsByType("player")) do local row = guiGridListAddRow ( playerList ) guiGridListSetItemText ( playerList, row, column, getPlayerName ( player ), false, false ) end -- Correct after refresh guiGridListSetSelectedItem( playerList, row, col ) end end, 5000, 0 ) else showCursor ( false ) guiSetVisible( phoneGui, false ) if isTimer( updateTimer[localPlayer] ) then killTimer( updateTimer[localPlayer] ) end guiSetInputEnabled( false ) end end addCommandHandler( "phone", togglePhone, source ) -- On editor focus function disableInput( ) if source == smsTextBox then guiSetInputEnabled( true ) end end addEventHandler( "onClientGUIClick", smsTextBox, disableInput ) -- Stop the radio function stopRadio( ) if isElement( sound ) and source == button1 then setSoundVolume( sound, 0 ) destroyElement( sound ) end end addEventHandler( "onClientGUIClick", button1, stopRadio ) -- Close the gui function exitPhone( ) if source == button6 then showCursor ( false ) guiSetVisible( phoneGui, false ) if isTimer( updateTimer[localPlayer] ) then killTimer( updateTimer[localPlayer] ) end guiSetInputEnabled( false ) end end addEventHandler( "onClientGUIClick", button6, exitPhone ) -- Home button function phoneBack( ) if source == button2 then showCursor ( false ) guiSetVisible( phoneGui, false ) if isTimer( updateTimer[localPlayer] ) then killTimer( updateTimer[localPlayer] ) end guiSetInputEnabled( false ) end end addEventHandler( "onClientGUIClick", button2, phoneBack ) -- Call service function callService( ) if source == button7 then local row,col = guiGridListGetSelectedItem( phoneList ) local call = guiGridListGetItemText( phoneList, row, col ) triggerServerEvent ( "onSendCall", localPlayer, call ) end end addEventHandler( "onClientGUIClick", button7, callService ) -- Volume up function volUp( ) if source == button4 then local vol = math.floor(tonumber( guiGetText ( editBox ))) if vol < 91 then vol = vol+10 guiSetText( editBox, tostring( vol )) end setSoundVolume( sound, vol/100 ) end end addEventHandler( "onClientGUIClick", button4, volUp ) -- Volume down function volDown( ) if source == button5 then local vol = math.floor(tonumber( guiGetText ( editBox ))) if vol > 9 then vol = vol-10 guiSetText( editBox, tostring( vol )) end setSoundVolume( sound, vol/100 ) end end addEventHandler( "onClientGUIClick", button5, volDown ) -- Send SMS to player function sendSMS( ) if source == button3 then local row,col = guiGridListGetSelectedItem( playerList ) local rec = guiGridListGetItemText(playerList, row, col ) local recPlayer = getPlayerFromName( rec ) if isElement( recPlayer ) and getElementType( recPlayer ) == "player" then if recPlayer ~= localPlayer then triggerServerEvent ( "onSendSMS", localPlayer, getPlayerFromName( rec ), guiGetText( smsTextBox )) guiSetInputEnabled( false ) else exports["AC_message"]:outputTopBar( "You can't SMS yourself!", 255, 0, 0) end else exports["AC_message"]:outputTopBar( "The person you want to SMS is not available now ("..rec..")", 255, 0, 0) end end end addEventHandler( "onClientGUIClick", button3, sendSMS ) Link to comment
Moderators Citizen Posted March 9, 2014 Moderators Share Posted March 9, 2014 What are the buttons you want to add onClientGUIClick event on ? Link to comment
Red-Pitbull Posted March 9, 2014 Author Share Posted March 9, 2014 like player press sms button. sms window open Link to comment
Moderators Citizen Posted March 9, 2014 Moderators Share Posted March 9, 2014 like player press sms button. sms window open I meant: Give me the line numbers of the buttons you added (use google translate to understand what I'm asking for) I don't have time to check if a gui element doesn't have its handler for this event. Link to comment
AlvareZ_ Posted March 9, 2014 Share Posted March 9, 2014 "GUIEditor.staticimage[1]" not defined! Link to comment
Moderators Citizen Posted March 9, 2014 Moderators Share Posted March 9, 2014 Check the comments: phone = guiCreateButton(17, 84, 46, 40, "Phone", false, img) sms = guiCreateButton(63, 84, 46, 40, "sms", false, img) radio = guiCreateButton(109, 84, 46, 40, "radio", false, img) --- Here is how to add a clic listener on a button --- function phoneClick( button ) if button ~= "left" then return end --only allow left mouse clic --Do something here like showing others images etc end addEventHandler("onClientGUIClick", phone, phoneClick, false) ------------------------------------------------------ --Copy paste and replace names to add clic listener on the two others buttons Link to comment
Mr_Moose Posted March 9, 2014 Share Posted March 9, 2014 I guess your goal is to make this look just like a real Nokia phone with Windows phone os, first of all I don't think the tab panel are the best thing to keep, after all this is a GUI window, holding an image of the phone which holds a tab panel, I suggest using GUI window elements for all "apps" including the start screen, then show and hide depending on which is active. I'm planning to add those features in the next release of this script anyway but we'll see when there is time for that. Link to comment
Red-Pitbull Posted March 24, 2014 Author Share Posted March 24, 2014 ok thanks and one more question how i make facebook like cit. player can add friends,block friends and player can create his status all player see this on his timelime and also share on friends timeline pls tell which function and element i use Link to comment
WhoAmI Posted March 24, 2014 Share Posted March 24, 2014 Well, this is more complicated script. For that you need some database knowledge and your LUA would have to be more professional. Link to comment
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