Jump to content

scienziato-pazzo

Members
  • Posts

    108
  • Joined

  • Last visited

Everything posted by scienziato-pazzo

  1. Ok, now this is the full script. Client: Expired Server: Expired
  2. I posted the full code. None can help me?
  3. 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)
  4. 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)
  5. 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).
  6. 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
  7. 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.
  8. Yes, but I use dxCreateFont to set the font-size, because if I set it in the dxDrawText function, the font is different.
  9. Hi, I used dxCreateFont to use my custom font on the script. But how can I set the font-size depending on the screen resolution?
  10. Why this function doesn't work? showPlayerHudComponent("clock", false) function updateHud() --outputChatBox("function test") -- It works local screenWidth, screenHeight = guiGetScreenSize() local sx, sy = screenWidth/1400, screenHeight/900 local realtime = getRealTime() local hour = realtime.hour local minute = realtime.minute local timestring = string.format("%i:%i", hour, minute) dxDrawText(timestring, 1229*sx, 56*sy, 140*sx, 148*sy, 0xFFFFFF, 140*sx, 148*sy) end function timeHudF() --outputChatBox("culo") -- It works addEventHandler("onClientRender", getRootElement(), updateHud) end addEvent("timeHud", true) addEventHandler("timeHud", getRootElement(), timeHudF) The function timeHud is called from the server, and all works, but if I add the last 3 parameters to dxDrawText, it doesn't work. I wanna set the font bigger than how is presented by default.
  11. Now all works. I don't know why, but it's a miracle.
  12. I already posted it up. function hudChanger() triggerClientEvent("timeHud", getRootElement()) end addEventHandler("onPlayerSpawn", getRootElement(), hudChanger)
  13. I added that showPlayerHudComponent("clock", false) function updateHud() outputChatBox("function test") -- It doesn't work local screenWidth, screenHeight = guiGetScreenSize() local sx, sy = screenWidth/1400, screenHeight/900 --[[local realtime = getRealTime() local hour = realtime.hour local minute = realtime.minute]]-- dxDrawText("00:00", 1229*sx, 56*sy, 140*sx, 148*sy) end function timeHudF() outputChatBox("test") -- It doesn't work addEventHandler("onClientRender", getRootElement(), updateHud) end addEvent("timeHud", true) addEventHandler("timeHud", getRootElement(), timeHudF) But it doesn't work.
  14. It's called by the server. EDIT: Yes, it doesn't work. The server script is this: function hudChanger() triggerClientEvent("timeHud", getRootElement()) end addEventHandler("onPlayerSpawn", getRootElement(), hudChanger)
  15. Hi, I wrote this script for the client: showPlayerHudComponent("clock", false) function updateHud() outputChatBox("function test") -- It doesn't work local screenWidth, screenHeight = guiGetScreenSize() local sx, sy = screenWidth/1400, screenHeight/900 --[[local realtime = getRealTime() local hour = realtime.hour local minute = realtime.minute]]-- dxDrawText("00:00", 1229*sx, 56*sy, 140*sx, 148*sy) end function timeHudF() addEventHandler("onClientRender", getRootElement(), updateHud) end addEventHandler("timeHud", getRootElement(), timeHudF) But the function updateHud is not called. Why?
  16. Solved. I had to increment the scaleX and the scaleY.
  17. Now I can see the gui elements, but the labels are "Userna" and "Passwo". They display only 6 characters.
  18. It doesn't work. It sets a wrong position.
  19. Hi, I used this script: local x, y = guiGetScreenSize() local sx, sy = x/1440, y/900 GUIEditor.button[1] = guiCreateButton(446*sx, 450*sy, 173*sx, 54*sy, "Login", false) GUIEditor.button[2] = guiCreateButton(667*sx, 450*sy, 173*sx, 54*sy, "Registrati", false) GUIEditor.label[1] = guiCreateLabel(461*sx, 261*sy, 58*sx, 18*sy, "Username", false) GUIEditor.label[2] = guiCreateLabel(461*sx, 378*sy, 58*sx, 18*sy, "Password", false) GUIEditor.edit[1] = guiCreateEdit(648*sx, 270*sy, 187*sx, 27*sy, "", false) GUIEditor.edit[2] = guiCreateEdit(648*sx, 378*sy, 187*sx, 27*sy, "", false) But the labels are showed completely on 1440x900 resolution, but not on 800x600 resolution. Why?
×
×
  • Create New...