Jump to content

[Solved] Grid List & outputChatBox Stress Me :|


HunT

Recommended Posts

I finish my own admin panel race but Bugged (facepalm)

i select the player for push and push me -.- ( :lol: )

ClientSide GridList :

playersList = guiCreateGridList(28,85,146,149,false,bigWindow) 
        local column = guiGridListAddColumn(playersList, "Drivers", 0.85) 
        if (column) then 
            for id, playeritem in ipairs(getElementsByType("player")) do 
            local row = guiGridListAddRow ( playersList ) 
        guiGridListSetItemText(playersList, row, column, getPlayerName(playeritem), false, false) 
        guiGridListSetItemColor ( playersList,  row,  column, 255, 150, 0 ) 
        guiGridListSetScrollBars ( playersList, true, true ) 
            end 
        end 
            function guiGridListRemoveRowByName ( playersList , column , name ) 
    for index = 1 , guiGridListGetRowCount ( playersList ) do 
    if guiGridListGetItemText ( playersList , index , column ) == name then 
    guiGridListRemoveRow ( playersList , index ) 
    break 
    end 
    end 
    end      

ClientSide onClientGUIClick :

function onGuiClick (button, state, absoluteX, absoluteY) 
  
if (source == botton1) then 
    client = getLocalPlayer() 
    selectedPlayer = guiGridListGetItemText ( playersList, guiGridListGetSelectedItem (playersList), 1 ) 
    if ( guiGridListGetSelectedItem ( playersList ) ~= -1 ) then 
           triggerServerEvent ("pushim",getLocalPlayer(),selectedPlayer, client) 
           else 
        outputChatBox("No user selected :|'", nil , 255, 0, 0, false) 
        end 
end 
addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) 

ServerSide triggerServerEvent :

addEvent("pushim", true) 
addEventHandler("pushim", rootElement, 
  function()  
    local vehicle = getPedOccupiedVehicle(source) 
         x,y,z = getElementVelocity(vehicle) 
        setElementVelocity ( vehicle, x, y, z+0.30) 
         outputChatBox("PRO|Admin Panel : Push "  ..getPlayerName(source), getRootElement(), 255, 200, 0, true) 
    end 
) 

And the outputChatBox show ever my name :cry:

where wrong ???? help me please

Edited by Guest
Link to comment

server:

addEvent("pushim", true) 
addEventHandler("pushim", rootElement, 
  function(player) 
    local vehicle = getPedOccupiedVehicle(player) 
         x,y,z = getElementVelocity(vehicle) 
        setElementVelocity ( vehicle, x, y, z+0.30) 
         outputChatBox("PRO|Admin Panel : Push "  ..getPlayerName(player), getRootElement(), 255, 200, 0, true) 
    end 
) 

You are sending an argument containing the selected player, but you are not using it, you are using source, which is the player who is using the panel.

And you don't need client argument @ triggerServerEvent ( "pushhim" )

function onGuiClick (button, state, absoluteX, absoluteY) 
  
if (source == botton1) then 
    selectedPlayer = guiGridListGetItemText ( playersList, guiGridListGetSelectedItem (playersList), 1 ) 
    if ( guiGridListGetSelectedItem ( playersList ) ~= -1 ) then 
           triggerServerEvent ("pushim",getLocalPlayer(),selectedPlayer) 
           else 
        outputChatBox("No user selected \"{SMILIES_PATH}/icon_neutral.gif\" alt=\"\" title=\"Neutral\" />'", nil , 255, 0, 0, false) 
        end 
end 
addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) 

Link to comment
addEvent("pushim", true) 
addEventHandler("pushim", rootElement, 
  function(name) 
    local player = getPlayerFromName(name) 
    local vehicle = getPedOccupiedVehicle(player) 
         x,y,z = getElementVelocity(vehicle) 
        setElementVelocity ( vehicle, x, y, z+0.30) 
         outputChatBox("PRO|Admin Panel : Push "  ..getPlayerName(player), getRootElement(), 255, 200, 0, true) 
    end 
) 

Link to comment
addEvent("pushim", true) 
addEventHandler("pushim", rootElement, 
  function(name) 
    local player = getPlayerFromName(name) 
    local vehicle = getPedOccupiedVehicle(player) 
         x,y,z = getElementVelocity(vehicle) 
        setElementVelocity ( vehicle, x, y, z+0.30) 
         outputChatBox("PRO|Admin Panel : Push "  ..getPlayerName(player), getRootElement(), 255, 200, 0, true) 
    end 
) 

Now is Perfect.

Tnx TheRock :mrgreen:

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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