scienziato-pazzo Posted January 17, 2014 Posted January 17, 2014 I reported the issue here: http://bugs.mtasa.com/view.php?id=7995, but I wanna know if for one of you it works without problems.
TAPL Posted January 17, 2014 Posted January 17, 2014 GUI Client side is not affected by other players, post your code so we can see what you're doing wrong.
scienziato-pazzo Posted January 17, 2014 Author Posted January 17, 2014 (edited) function attivaSceltaPersonaggi() local screenWidth, screenHeight = guiGetScreenSize() local sx, sy = screenWidth/1440, screenHeight/900 listapersonaggi = guiCreateGridList(360*sx, 185*sy, 320*sx, 168*sy, false) guiGridListSetSelectionMode(listapersonaggi, 2) guiSetVisible(listapersonaggi, false) creapgbutt = guiCreateButton(360*sx, 366*sy, 120*sx, 80*sy, "Crea Personaggio", false) eliminapgbutt = guiCreateButton(560*sx, 368*sy, 120*sx, 80*sy, "Elimina Personaggio", false) selezionapgbutt = guiCreateButton(460*sx, 500*sy, 150*sx, 50*sy, "SELEZIONA", false) guiSetVisible(creapgbutt, false) guiSetVisible(eliminapgbutt, false) guiSetVisible(selezionapgbutt, false) addEventHandler("onClientGUIClick", selezionapgbutt, spawnaPg, false) addEventHandler("onClientGUIClick", creapgbutt, creaPg, false) end addEvent("onSceltaPersonaggioAttiva", true) addEventHandler("onSceltaPersonaggioAttiva", getRootElement(), attivaSceltaPersonaggi) function spawnaPg(button, state, absoluteX, absoluteY) -- Funzione invio spawn Personaggio SERVER --outputChatBox(itemselezionato) local riga, colonna = guiGridListGetSelectedItem ( listapersonaggi ) local itemselezionato = guiGridListGetItemText ( listapersonaggi, riga, colonna ) if button == "left" then if state == "up" then outputChatBox(riga .. colonna) if riga ~= -1 and colonna ~= -1 then outputChatBox(itemselezionato) disattivaSelezionePersonaggio() showCursor(false) stopSound(logintheme) triggerServerEvent("spawnaPersonaggio", localPlayer, itemselezionato) else outputChatBox("ERROR: Niente selezionato.") end end end end Edited January 17, 2014 by Guest
TAPL Posted January 17, 2014 Posted January 17, 2014 Where is the server side? Where the function creaPg?
scienziato-pazzo Posted January 17, 2014 Author Posted January 17, 2014 Where is the server side?Where the function creaPg? This is a part of the code, but these functions work, while this part of the code is bugged (it works, but if two players click on the selezionapgbutt button at the same time, the row value is -1).
TAPL Posted January 17, 2014 Posted January 17, 2014 I know that and i asking you to show the server side as you're doing trigger from the server to the client side and from client side to server side of course this will affect the client side if you doing it wrong, also column is not defined and i can't see the function disattivaSelezionePersonaggio and where are you adding any row in the gird list.
scienziato-pazzo Posted January 17, 2014 Author Posted January 17, 2014 function spawnaPersonaggioF(itemselezionato) --print(itemselezionato) --outputChatBox(itemselezionato) --if client then --if source == sourceRoot then print("lezzetti") setPlayerName(client, itemselezionato) spawnPlayer(client, 0.0, 0.0, 4.0) fadeCamera(client, true) setCameraTarget(client) --end --end end addEvent("spawnaPersonaggio", true) addEventHandler("spawnaPersonaggio", root, spawnaPersonaggioF)
scienziato-pazzo Posted January 19, 2014 Author Posted January 19, 2014 Client-side: function attivaSceltaPersonaggi() local screenWidth, screenHeight = guiGetScreenSize() local sx, sy = screenWidth/1440, screenHeight/900 listapersonaggi = guiCreateGridList(360*sx, 185*sy, 320*sx, 168*sy, false) guiGridListSetSelectionMode(listapersonaggi, 2) guiSetVisible(listapersonaggi, false) creapgbutt = guiCreateButton(360*sx, 366*sy, 120*sx, 80*sy, "Crea Personaggio", false) eliminapgbutt = guiCreateButton(560*sx, 368*sy, 120*sx, 80*sy, "Elimina Personaggio", false) selezionapgbutt = guiCreateButton(460*sx, 500*sy, 150*sx, 50*sy, "SELEZIONA", false) guiSetVisible(creapgbutt, false) guiSetVisible(eliminapgbutt, false) guiSetVisible(selezionapgbutt, false) addEventHandler("onClientGUIClick", selezionapgbutt, spawnaPg, false) addEventHandler("onClientGUIClick", creapgbutt, creaPg, false) end addEvent("onSceltaPersonaggioAttiva", true) addEventHandler("onSceltaPersonaggioAttiva", getRootElement(), attivaSceltaPersonaggi) function spawnaPg(button, state, absoluteX, absoluteY) -- Funzione invio spawn Personaggio SERVER --outputChatBox(itemselezionato) local riga, colonna = guiGridListGetSelectedItem ( listapersonaggi ) local itemselezionato = guiGridListGetItemText ( listapersonaggi, riga, colonna ) if button == "left" then if state == "up" then outputChatBox("Riga: " .. riga .. " Colonna: " .. colonna) if riga ~= -1 and colonna ~= -1 then outputChatBox(itemselezionato) disattivaSelezionePersonaggio() showCursor(false) stopSound(logintheme) triggerServerEvent("spawnaPersonaggio", localPlayer, itemselezionato) else outputChatBox("ERROR: Niente selezionato.") end end end end Server-side: function spawnaPersonaggioF(itemselezionato) --print(itemselezionato) --outputChatBox(itemselezionato) --if client then --if source == sourceRoot then print("test") setPlayerName(client, itemselezionato) spawnPlayer(client, 0.0, 0.0, 4.0) fadeCamera(client, true) setCameraTarget(client) --end --end end addEvent("spawnaPersonaggio", true) addEventHandler("spawnaPersonaggio", root, spawnaPersonaggioF)
scienziato-pazzo Posted January 20, 2014 Author Posted January 20, 2014 I posted the full code. None can help me?
TAPL Posted January 20, 2014 Posted January 20, 2014 I posted the full code. None can help me? That's not the full code, you've already posted that above.
scienziato-pazzo Posted January 20, 2014 Author Posted January 20, 2014 (edited) Ok, now this is the full script. Client: Expired Server: Expired Edited January 21, 2014 by Guest
TAPL Posted January 20, 2014 Posted January 20, 2014 triggerClientEvent("onSceltaPersonaggioAttiva", getRootElement()) Should be: triggerClientEvent(thePlayer, "onSceltaPersonaggioAttiva", getRootElement())
Controlled Posted January 21, 2014 Posted January 21, 2014 Just to better explain, you need the "thePlayer" infront to define who the event is getting triggered for. Before you had it triggering for everyone in the server.
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