iFoReX Posted April 26, 2012 Share Posted April 26, 2012 como triggear esto cl-side GUIEditor_Window = {} GUIEditor_Label = {} GUIEditor_Grid = {} function creandoLaGUI() GUIEditor_Window[1] = guiCreateWindow(0.2275,0.2367,0.5400,0.5200,"GUI Stats",true) GUIEditor_Grid[1] = guiCreateGridList(261,36,158,280,false,GUIEditor_Window[1]) column = guiGridListAddColumn(GUIEditor_Grid[1],"Jugadores",0.80) GUIEditor_Label[1] = guiCreateLabel(10,58,233,23,"Nickname : \"\"",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Label[1],"clear-normal") GUIEditor_Label[2] = guiCreateLabel(10,91,233,23,"Location : \"\"",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Label[2],"clear-normal") GUIEditor_Label[4] = guiCreateLabel(10,157,233,23,"Skin : \"\"",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Label[4],"clear-normal") GUIEditor_Label[5] = guiCreateLabel(10,190,233,23,"Ping : \"\"",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Label[5],"clear-normal") GUIEditor_Label[6] = guiCreateLabel(10,223,233,23,"Dimension : \"\"",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Label[6],"clear-normal") GUIEditor_Label[7] = guiCreateLabel(10,125,233,23,"Team : \"\"",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Label[7],"clear-normal") GUIEditor_Label[9] = guiCreateLabel(10,259,149,16,"Stars : \"\"",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Label[8],"default-bold-small") GUIEditor_Label[8] = guiCreateLabel(10,290,149,16,"GUI Made By ElMota",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[8],255,255,0) guiSetFont(GUIEditor_Label[8],"default-bold-small") guiSetVisible( GUIEditor_Window[1], false ) showCursor ( false ) guiWindowSetSizable ( GUIEditor_Window[1], false ) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), creandoLaGUI) function showGUI ( ) guiSetVisible ( GUIEditor_Window[1], not guiGetVisible ( GUIEditor_Window[1] ) ) showCursor ( guiGetVisible ( GUIEditor_Window[1] ) ) end bindKey ( "F2","down", showGUI ) function atualizarlista() guiGridListClear(GUIEditor_Grid[1]) if (guiGridListClear) then for id, players in ipairs (getElementsByType("player")) do local row = guiGridListAddRow(GUIEditor_Grid[1]) guiGridListSetItemText(GUIEditor_Grid[1], row, 1, (getPlayerName(players)), false, false) guiGridListSetItemColor ( GUIEditor_Grid[1], row, 1, 255, 255, 0, 255 ) end end end addEventHandler("onClientPlayerJoin", getRootElement(), atualizarlista) addEventHandler("onClientPlayerQuit", getRootElement(), atualizarlista) addEventHandler("onClientPlayerChangeNick", getRootElement(), atualizarlista) addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), atualizarlista) function anunciarGUI() outputChatBox( "[server] #000FFFPara ver la GUI De Stats porfavor preciona #00FF00F2", 255, 0, 0, true ) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), anunciarGUI) addEventHandler("onClientPlayerJoin", anunciarGUI2) function anunciarGUI2() outputChatBox( "[server] #000FFFPara ver la GUI De Stats porfavor preciona #00FF00F2", localPlayer, 255, 0, 0, true ) end setTimer( function() outputChatBox( "[server] #000FFFPara ver la GUI De Stats porfavor preciona #00FF00F2", 255, 0, 0, true ) end , 300000, 1 ) function setStats ( ) if ( source == GUIEditor_Grid[1] ) then row, col = guiGridListGetSelectedItem ( source ) if ( row and col and row ~= -1 and col ~= -1 ) then local playername = guiGridListGetItemText ( source, row, col ) local thePlayer = getPlayerFromName ( playername ) if ( thePlayer ) then local x, y, z = getElementPosition ( thePlayer ) local location = getZoneName ( x, y, z ) local money = getPlayerMoney( thePlayer ) local id = getElementModel( thePlayer ) local ping = getPlayerPing( thePlayer ) local dm = getElementDimension( thePlayer ) local tm1 = getPlayerTeam( thePlayer ) local tm2 = getTeamName( tm1 ) guiSetText ( GUIEditor_Label[1], "Nickname : ".. playername ) guiSetText ( GUIEditor_Label[2], "Location : ".. location ) guiSetText ( GUIEditor_Label[4], "Skin : ".. id ) guiSetText ( GUIEditor_Label[6], "Dimension : ".. dm ) guiSetText ( GUIEditor_Label[7], "Team : ".. tm2 ) if ( ping > 300 ) then guiSetText ( GUIEditor_Label[5], "Ping ( very Bad ) : ".. ping ) elseif ( ping < 300 ) and ( ping > 150 ) then guiSetText ( GUIEditor_Label[5], "Ping ( Good ) : ".. ping ) elseif ( ping < 150 ) and ( ping > 100 ) then guiSetText ( GUIEditor_Label[5], "Ping ( VeryGood ) : ".. ping ) elseif ( ping < 100 ) and ( ping > 150 ) then guiSetText ( GUIEditor_Label[5], "Ping ( Nice! ) : ".. ping ) elseif ( ping > 50 ) and ( ping < 100 ) then guiSetText ( GUIEditor_Label[5], "Ping ( ChileanPlayer! ) : ".. ping ) elseif ( ping > 0 ) and ( ping < 50 ) then guiSetText ( GUIEditor_Label[5], "Ping ( ElMota! ) : ".. ping ) end end end end end addEventHandler ( "onClientGUIDoubleClick", root, setStats ) local table = {{255, 0, 0},{0, 255, 0},{0, 0, 255},{255, 255, 0}} setTimer( function () guiLabelSetColor( GUIEditor_Label[8], unpack(table[math.random(#table)]) ) end , 400, 0 ) con este sv-side function getwan() local players = getElementsByType ( "player" ) for theKey,thePlayer in ipairs(players) do local wanted = getPlayerWantedLevel(thePlayer) local zero = "" local one = "*" local two = "**" local three = "***" local four = "****" local five = "*****" local six = "******" if wanted == 0 then setElementData ( thePlayer, "Wanted", zero ) else if wanted == 1 then setElementData ( thePlayer, "Wanted", one ) else if wanted == 2 then setElementData ( thePlayer, "Wanted", two ) else if wanted == 3 then setElementData ( thePlayer, "Wanted", three ) else if wanted == 4 then setElementData ( thePlayer, "Wanted", four ) else if wanted == 5 then setElementData ( thePlayer, "Wanted", five ) else if wanted == 6 then setElementData ( thePlayer, "Wanted", six ) end end end end end end end end end setTimer(getwan,100,0) addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), getwan ) Para obtener las estrellas del player y escribirlas al seleccionar a un player en el gridlist Link to comment
Castillo Posted April 26, 2012 Share Posted April 26, 2012 Usa: getElementData client side. Link to comment
iFoReX Posted April 26, 2012 Author Share Posted April 26, 2012 no me funciono cl-side getElementData( thePlayer, "wanted" ) if wanted == 0 then local zero = getElementData( thePlayer, "zero" ) guiSetText ( GUIEditor_Label[9], "stars" ..zero ) end end end end end addEventHandler ( "onClientGUIDoubleClick", root, setStats ) sv-side function estrellas() local players = getElementsByType ( "player" ) for theKey,thePlayer in ipairs(players) do local wanted = getPlayerWantedLevel(thePlayer) setElementData ( thePlayer, "wanted", wanted ) local zero = "" local one = "*" local two = "**" local three = "***" local four = "****" local five = "*****" local six = "******" if wanted == 0 then setElementData ( thePlayer, "zero", zero ) else if wanted == 1 then setElementData ( thePlayer, "one", one ) else if wanted == 2 then setElementData ( thePlayer, "two", two ) else if wanted == 3 then setElementData ( thePlayer, "three", three ) else if wanted == 4 then setElementData ( thePlayer, "four", four ) else if wanted == 5 then setElementData ( thePlayer, "five", five ) else if wanted == 6 then setElementData ( thePlayer, "six", six ) end end end end end end end end end setTimer(estrellas,100,0) addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), estrellas ) Link to comment
Renkon Posted April 26, 2012 Share Posted April 26, 2012 No sería MUCHIIIIIIIIISIMO mas facil crear una string llamada estrellitaspolice Y usar clientsided el Wanted LEVEL? y segun el nivel estrellitaspolice seria igual a "*" o "**", etc?. Segundo, luego de eso si lo necesitas serverside lo puedes triggear Tercero.. Mota, te falta bastante lógica, y ser mas "limpio" y "organizado" con tus scripts. Link to comment
Recommended Posts