Flipi Posted October 16, 2013 Share Posted October 16, 2013 Hola, este script consiste en el momento de escribir arriba del player aparezca una imagen, la cosa es que como puedo hacer que al escribir la imagen que aparece arriba del player cambie a diferentes imágenes... Imágenes distintas: Imagen 1: http://imageshack.us/a/img14/6968/fv91.png Imagen 2: http://imageshack.us/a/img191/2332/jddj.png Imagen 3: http://imageshack.us/a/img845/2857/9nvy.png (son 5 imágenes, como puedo hacer que al momento de escribir la imagen de la nube al principio este vacía, después aparezca la nube con el punto y así sucesivamente...me explique bien?) nose si será necesario el server-side....... Client.... local showMyIcon = true local chattingPlayers = {} local drawDistance = 1000 local transicon = false local chatIconFor = {} local screenSizex, screenSizey = guiGetScreenSize() local guix = screenSizex * 0.1 local guiy = screenSizex * 0.1 local globalscale = 1.4 local globalalpha = 255 addEvent("updateChatList", true ) gChatting = false function chatCheckPulse() local chatState = isChatBoxInputActive() or isConsoleActive() if chatState ~= gChatting then if chatState then triggerServerEvent("playerChatting", getLocalPlayer()) else triggerServerEvent("playerNotChatting", getLocalPlayer()) end gChatting = chatState end setTimer( chatCheckPulse, 250, 1) end function showTextIcon() local playerx,playery,playerz = getElementPosition ( getLocalPlayer() ) for player, truth in pairs(chattingPlayers) do if (player == getLocalPlayer()) then if(not showMyIcon) then return end end if(truth) then local chatx, chaty, chatz = getElementPosition( player ) if(isPedInVehicle(player)) then chatz = chatz + .5 end local dist = getDistanceBetweenPoints3D ( playerx, playery, playerz, chatx, chaty, chatz ) if dist < drawDistance then if( isLineOfSightClear(playerx, playery, playerz, chatx, chaty, chatz, true, false, false, false )) then local screenX, screenY = getScreenFromWorldPosition ( chatx, chaty, chatz+1.2 ) local scaled = screenSizex * (1/(2*(dist+5))) *.85 local relx, rely = scaled * globalscale, scaled * globalscale guiSetAlpha(chatIconFor[player], globalalpha) guiSetSize(chatIconFor[player], relx, rely, false) guiSetPosition(chatIconFor[player], screenX, screenY, false) if(screenX and screenY) then guiSetVisible(chatIconFor[player], true) end end end end end end function updateList(newEntry, newStatus) chattingPlayers[newEntry] = newStatus if(not chatIconFor[newEntry]) then chatIconFor[newEntry] = guiCreateStaticImage(0, 0, guix, guiy, "chat.png", false ) end guiSetVisible(chatIconFor[newEntry], false) end function toggleIcon() outputChatBox ( "Your icon is: " ) if( showMyIcon ) then showMyIcon = false outputChatBox ( "off", 255, 0, 0) else showMyIcon = true outputChatBox ( "on", 0, 255, 0) end end function resizeIcon( command, newSize ) if(newSize) then local resize = tonumber( newSize ) local percent = resize/100 globalscale = percent end outputChatBox("Chat icons are "..(globalscale * 100).."% normal size") end function setIconAlpha( command, newSize ) if(newSize) then globalalpha = tonumber( newSize ) / 100 end outputChatBox("Chat icons are "..(globalalpha * 100).."% visible") end addEventHandler ( "updateChatList", getRootElement(), updateList ) addEventHandler ( "onClientResourceStart", getRootElement(), chatCheckPulse ) addEventHandler ( "onClientPlayerJoin", getRootElement(), chatCheckPulse ) addEventHandler ( "onClientRender", getRootElement(), showTextIcon ) addCommandHandler( "toggleicon", toggleIcon) addCommandHandler( "resizeicon", resizeIcon) addCommandHandler( "seticonvis", setIconAlpha) Link to comment
Castillo Posted October 16, 2013 Share Posted October 16, 2013 Queres que vaya cambiando como si fuese una animacion? Link to comment
Flipi Posted October 16, 2013 Author Share Posted October 16, 2013 Queres que vaya cambiando como si fuese una animacion? claro, si ves las imágenes en orden entenderás a lo que me refiero.... mientras estas escribiendo en el chat box la imagen de la nube vaya cambiando.. Link to comment
Castillo Posted October 16, 2013 Share Posted October 16, 2013 Usa: guiStaticImageLoadImage Link to comment
Flipi Posted October 22, 2013 Author Share Posted October 22, 2013 Usa: guiStaticImageLoadImage y como lo agrego al script si ya tengo un guiStaticImageLoadImage? Link to comment
Recommended Posts