Jump to content

Tema pasado ["3"]


Plate

Recommended Posts

hola hace poco hize un gui pero no funciona par agregar a las personas pero no funciona

addEventHandler("onClientResourceStart",resourceRoot, 
    function() 
        GUIEditor_Window = {} 
        GUIEditor_Button = {} 
        GUIEditor_Grid = {} 
  
        Panel = guiCreateWindow(138,146,499,282,"Panel",false) 
        GUIEditor_Grid[1] = guiCreateGridList(363,59,127,195,false,Faction) 
        guiGridListSetSelectionMode(GUIEditor_Grid[1],2) 
  
        guiGridListAddColumn(GUIEditor_Grid[1],"Players in F",0.5) 
        Players = guiCreateGridList(9,58,127,196,false,Faction) 
        guiGridListSetSelectionMode(Players,2) 
  
        guiGridListAddColumn(Players,"Players",0.5) 
        Add = guiCreateButton(177,60,135,49,"Add Player",false,Faction) 
        Remove = guiCreateButton(174,132,142,51,"Remove Player",false,Faction) 
        Leader = guiCreateButton(173,203,145,48,"Give Leader",false,Faction) 
    end 
) 
  
  
function addP() 
guiSetVisible (Panel,true) 
showCursor(true) 
end 
addCommandHandler("AFP",addP)  
  
function closePanel() 
    if guiGetVisible(Panel) then 
        guiSetVisible(Panel,false) 
        showCursor(false) 
    end 
end 
addCommandHandler("CFP",closePanel) 
function STARS ( ) 
    triggerServerEvent ( "addST", localPlayer, accountName ) 
end 
addEventHandler ( "onClientGUIClick", Add, STARS, false ) 
function loadPlayers ( ) 
    guiGridListClear ( Players )  
  
    for index, player in ipairs ( getElementsByType ( "player" ) ) do  
        guiGridListSetItemText ( Players, guiGridListAddRow ( Players ), 1, tostring ( getPlayerName ( player ) ), false, false ) 
    end 
end 
addEventHandler ( "onClientResourceStart", resourceRoot, loadPlayers ) 
addEventHandler ( "onClientPlayerJoin", root, loadPlayers ) 
addEventHandler ( "onClientPlayerQuit", root, loadPlayers ) 
addEventHandler ( "onClientPlayerChangeNick", root, loadPlayers ) 

server

addEvent ( "addST", true ) 
addEventHandler ( "addST", getRootElement(), 
    function ( accountName ) 
        local usuario = getAccountName ( getPlayerAccount ( source ) ) 
        if isObjectInACLGroup ( "user.".. usuario, aclGetGroup ( "LiderFTFP" ) )  then 
            if ( accountName ) then 
                local pname = getPlayerName ( source ) 
                aclGroupAddObject ( aclGetGroup ( "FTFP" ), "user.".. accountName ) 
                outputChatBox ( tostring ( pname ) .." agrego a  '".. accountName .."' a S.T.A.R.S", getRootElement(), 0, 255, 255, true ) 
            end 
        end 
    end 
) 

Link to comment
addEventHandler ( "onClientResourceStart", resourceRoot, 
    function ( ) 
        GUIEditor_Window = {} 
        GUIEditor_Button = {} 
        GUIEditor_Grid = {} 
  
        Panel = guiCreateWindow(138,146,499,282,"Panel",false) 
        GUIEditor_Grid[1] = guiCreateGridList(363,59,127,195,false,Faction) 
        guiGridListSetSelectionMode(GUIEditor_Grid[1],2) 
  
        guiGridListAddColumn(GUIEditor_Grid[1],"Players in F",0.5) 
        Players = guiCreateGridList(9,58,127,196,false,Faction) 
        guiGridListSetSelectionMode(Players,2) 
  
        guiGridListAddColumn(Players,"Players",0.5) 
        Add = guiCreateButton(177,60,135,49,"Add Player",false,Faction) 
        Remove = guiCreateButton(174,132,142,51,"Remove Player",false,Faction) 
        Leader = guiCreateButton(173,203,145,48,"Give Leader",false,Faction) 
  
        addEventHandler ( "onClientGUIClick", Add, STARS, false ) -- El evento tiene que ir dentro de esta funcion. 
        loadPlayers ( ) 
    end 
) 
  
  
function addP ( ) 
    guiSetVisible ( Panel, true ) 
    showCursor ( true ) 
end 
addCommandHandler("AFP",addP) 
  
function closePanel ( ) 
    if guiGetVisible ( Panel ) then 
        guiSetVisible ( Panel, false ) 
        showCursor ( false ) 
    end 
end 
addCommandHandler ( "CFP", closePanel ) 
  
function STARS ( ) 
    triggerServerEvent ( "addST", localPlayer, accountName ) 
end 
  
function loadPlayers ( ) 
    guiGridListClear ( Players ) 
  
    for index, player in ipairs ( getElementsByType ( "player" ) ) do 
        guiGridListSetItemText ( Players, guiGridListAddRow ( Players ), 1, tostring ( getPlayerName ( player ) ), false, false ) 
    end 
end 
addEventHandler ( "onClientPlayerJoin", root, loadPlayers ) 
addEventHandler ( "onClientPlayerQuit", root, loadPlayers ) 
addEventHandler ( "onClientPlayerChangeNick", root, loadPlayers ) 

Mira el comentario que hice.

P.D: Para que esto funcione, vas a tener que enviar el nombre del jugador al server side y ahi obtener el jugador y luego su cuenta.

Link to comment

va bien hay?

function NOSE() 
  guiGridListSetItemText ( Players, row, Players, getPlayerName ( playeritem ), false, false ) 
                PDat = guiGridListGetItemText ( Players, Players, Players ) 
        elseif getRandomItem == 2 then 
                PDat = guiGridListGetItemText ( Player, Players, Players ) 
        end 
  

Link to comment
va bien hay?
function NOSE() 
  guiGridListSetItemText ( Players, row, Players, getPlayerName ( playeritem ), false, false ) 
                PDat = guiGridListGetItemText ( Players, Players, Players ) 
        elseif getRandomItem == 2 then 
                PDat = guiGridListGetItemText ( Player, Players, Players ) 
        end 
  

Està incompleto eso.

Link to comment

es qe no entiendo pero voy a seguir intentando

podrian corregir esto que no tengo ni idea de lo que hize

   function() 
   level = dxDrawText("",686.0,158.0,746.0,166.0,tocolor(255,255,255,255),1.0,"default","left","top",false,false,false) 
        dxDrawText("",682.0,143.0,749.0,153.0,tocolor(255,255,255,255),1.0,"default","left","top",false,false,false) 
        dxDrawText("",633.0,142.0,663.0,167.0,tocolor(255,255,255,255),1.0,"default","left","top",false,false,false) 
        dxDrawRectangle(628.0,136.0,128.0,35.0,tocolor(255,255,255,255),false) 
    end 
) 
function drawLevel() 
triggerServerEvent ("dvl", getLocalPlayer(), thePlayer) 
addEventHandler("onResourceStart",getRootElement(),drawLevel) 

server

addEvent("dlv",true) 
addEventHandler("dlv",getRootElement(), 
function (thePlayer) 
exports["exp_system"]:getPlayerLevel(thePlayer) 
end) 
  

Link to comment

cl-side

function random() 
local playerName = guiGridListGetItemText ( GUIEditor_Grid[1], guiGridListGetSelectedItem ( GUIEditor_Grid[1] ), 1 ) 
triggerServerEvent("enviarVariable",localPlayer,playerName) 
end 

  
addEvent("enviarVariable",true) 
addEventHandler("enviarVariable",root,function (playerName) 
        local elPlayer = getPlayerFromName(playerName) 
        local usuario = getAccountName ( getPlayerAccount ( elPlayer ) ) 
        if isObjectInACLGroup ( "user.".. usuario, aclGetGroup ( "LiderFTFP" ) )  then 
            if ( accountName ) then 
                local pname = getPlayerName ( elPlayer ) 
                aclGroupAddObject ( aclGetGroup ( "FTFP" ), "user.".. accountName ) 
                outputChatBox ( tostring ( pname ) .." agrego a  '".. accountName .."' a S.T.A.R.S", getRootElement(), 0, 255, 255, true ) 
            end 
        end 
    end 
) 

prueba con algo asi :D

Link to comment

haci?

function random() 
local playerName = guiGridListGetItemText ( GUIEditor_Grid[1], guiGridListGetSelectedItem ( GUIEditor_Grid[1] ), 1 ) 
triggerServerEvent("enviarVariable",localPlayer,playerName) 
end 
 addEventHandler("onClientGUIClick",Add,random, false) 

addEvent("enviarVariable",true) 
addEventHandler("enviarVariable",root,function (playerName) 
        local elPlayer = getPlayerFromName(playerName) 
        local usuario = getAccountName ( getPlayerAccount ( elPlayer ) ) 
        if isObjectInACLGroup ( "user.".. usuario, aclGetGroup ( "LiderFTFP" ) )  then 
            if ( accountName ) then 
                local pname = getPlayerName ( elPlayer ) 
                aclGroupAddObject ( aclGetGroup ( "FTFP" ), "user.".. accountName ) 
                outputChatBox ( tostring ( pname ) .." agrego a  '".. accountName .."' a S.T.A.R.S", getRootElement(), 0, 255, 255, true ) 
            end 
        end 
    end 
) 

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...