Jump to content

Some Help To Fix a Simple Problem :) | [ RESOLVED ]


iPrestege

Recommended Posts

Hello Guys Am Working On My Own Script But I Have A Simple Problem!

The Problem Is When I Click On The Grid List The Grid Trigger The Event To The Server But The Server Trigger To Client But The Client Doesn't Set The Text On The Panel ;

-- Client --

addEventHandler("onClientGUIClick",guiRoot, 
    function ( button , state , absoluteX , absoluteY ) 
    local Player = guiGridListGetItemText ( MyAdmin.gridlist[1], guiGridListGetSelectedItem ( MyAdmin.gridlist[1] ), 1 ) 
    if ( source == MyAdmin.gridlist[1] ) then 
    if ( guiGridListGetSelectedItem(MyAdmin.gridlist[1]) ~= -1 ) then  
        triggerServerEvent("GetData",localPlayer,Player) 
    else 
        guiSetText(MyAdmin.label[2],"Nick : N/A") 
        guiSetText(MyAdmin.label[3],"Account Name : N/A") 
        guiSetText(MyAdmin.label[4],"IP : N/A") 
        guiSetText(MyAdmin.label[5],"Serial : N/A") 
        guiSetText(MyAdmin.label[6],"Verison : N/A") 
        guiSetText(MyAdmin.label[8],"Health  : N/A") 
        guiSetText(MyAdmin.label[9],"Armor  : N/A") 
        guiSetText(MyAdmin.label[10],"Skin : N/A") 
        guiSetText(MyAdmin.label[11],"Team  : N/A") 
        guiSetText(MyAdmin.label[13],"Money : N/A") 
        guiSetText(MyAdmin.label[14],"X : N/A") 
        guiSetText(MyAdmin.label[16],"Y : N/A") 
        guiSetText(MyAdmin.label[16],"Z : N/A") 
        guiSetText(MyAdmin.label[17],"Area : N/A") 
        guiSetText(MyAdmin.label[18],"Dimenison : N/A") 
        guiSetText(MyAdmin.label[19],"Interior : N/A") 
        guiSetText(MyAdmin.label[21],"Vehicle ID/Name : N/A") 
        guiSetText(MyAdmin.label[22],"Vehicle Health : N/A") 
        end 
    end 
end 
) 
  
addEvent("SetTextSelectedPlayerInfo",true) 
addEventHandler("SetTextSelectedPlayerInfo",getRootElement(), 
    function ( Nick,AccountName,IP,Serial,Health,Armor,Skin,teamName,Money,x,y,z,Area,Dimenison,Interior,VehicleID,VehicleName,VehicleHealth ) 
        guiSetText(MyAdmin.label[2],"Nick : "..Nick.." ") 
        guiSetText(MyAdmin.label[3],"Account Name : "..AccountName.." ") 
        guiSetText(MyAdmin.label[4],"IP : "..IP.." ") 
        guiSetText(MyAdmin.label[5],"Serial : "..Serial.." ") 
        guiSetText(MyAdmin.label[6],"Verison : Soon ") 
        guiSetText(MyAdmin.label[8],"Health  : "..Health.." ") 
        guiSetText(MyAdmin.label[9],"Armor  : "..Armor.." ") 
        guiSetText(MyAdmin.label[10],"Skin : "..Skin.." ") 
        guiSetText(MyAdmin.label[11],"Team  : "..teamName.." ") 
        guiSetText(MyAdmin.label[13],"Money : "..Money.." ") 
        guiSetText(MyAdmin.label[14],"X : "..x.." ") 
        guiSetText(MyAdmin.label[16],"Y : "..y.." ") 
        guiSetText(MyAdmin.label[16],"Z : "..z.." ") 
        guiSetText(MyAdmin.label[17],"Area : "..Area.." ") 
        guiSetText(MyAdmin.label[18],"Dimenison : "..Dimenison.." ") 
        guiSetText(MyAdmin.label[19],"Interior : "..Interior.." ") 
        guiSetText(MyAdmin.label[21],"Vehicle ID/Name : "..VehicleID.." | "..VehicleName.." ") 
        guiSetText(MyAdmin.label[22],"Vehicle Health : "..VehicleHealth.." ")    
    end 
) 
  

-- Server --

addEvent("GetData",true) 
addEventHandler("GetData",getRootElement(), 
function ( Player ) 
    local element = getPlayerFromName(Player) 
    local Nick = getPlayerName(element) 
    local Account = getPlayerAccount(element) 
    if  Account then 
    local AccountName = getAccountName(Account) or "N/A" 
    local IP = getPlayerIP(element) 
    local Serial = getPlayerSerial(element) 
    local Health = getElementHealth(element) 
    local Armor = getPedArmor(element) 
    local Skin = getElementModel(element) 
    local team = getPlayerTeam(element) 
    if team then 
    local teamName = getTeamName(team) or "N/A"  
    local Money = getPlayerMoney(element) 
    local x,y,z = getElementPosition(element) 
    local Area = getZoneName ( x,y,z ) 
    local Dimenison = getElementDimension(element) 
    local Interior = getElementInterior(element) 
    if not isPedInVehicle(element) then return end 
    local VehicleID = getElementModel(getPedOccupiedVehicle(element)) 
    local VehicleName = getVehicleName(getPedOccupiedVehicle(element)) 
    local VehicleHealth = getElementHealth(getPedOccupiedVehicle(element)) 
    if ( element and Nick and AccountName and IP and Serial and Health and Armor and Skin and teamName and Money and x and y and z and Area and Dimenison and Interior ) then 
    triggerClientEvent(source,"SetTextSelectedPlayerInfo",source,Nick,AccountName,IP,Serial,Health,Armor,Skin,teamName,Money,x,y,z,Area,Dimenison,Interior,VehicleID,VehicleName,VehicleHealth) 
                end 
        end 
    end 
end 
) 

I Hope Some One Will Help Me :P

Thanks In Advance!

Edited by Guest
Link to comment

Not sure, but try this:

    addEvent("GetData",true) 
    addEventHandler("GetData",getRootElement(), 
    function ( Player ) 
        local Nick = getPlayerName(Player) 
        local Account = getPlayerAccount(Player) 
        if  Account then 
        local AccountName = getAccountName(Account) or "N/A" 
        local IP = getPlayerIP(Player) 
        local Serial = getPlayerSerial(Player) 
        local Health = getElementHealth(Player) 
        local Armor = getPedArmor(Player) 
        local Skin = getElementModel(Player) 
        local team = getPlayerTeam(Player) 
        if team then 
        local teamName = getTeamName(team) or "N/A" 
        local Money = getPlayerMoney(Player) 
        local x,y,z = getElementPosition(Player) 
        local Area = getZoneName ( x,y,z ) 
        local Dimenison = getElementDimension(Player) 
        local Interior = getElementInterior(Player) 
        if not isPedInVehicle(Player) then return end 
        local VehicleID = getElementModel(getPedOccupiedVehicle(Player)) 
        local VehicleName = getVehicleName(getPedOccupiedVehicle(Player)) 
        local VehicleHealth = getElementHealth(getPedOccupiedVehicle(Player)) 
        if ( Player and Nick and AccountName and IP and Serial and Health and Armor and Skin and teamName and Money and x and y and z and Area and Dimenison and Interior ) then 
        triggerClientEvent(source,"SetTextSelectedPlayerInfo",source,Nick,AccountName,IP,Serial,Health,Armor,Skin,teamName,Money,x,y,z,Area,Dimenison,Interior,VehicleID,VehicleName,VehicleHealth) 
                    end 
            end 
        end 
    end 
    ) 

Link to comment
Bad argument @ getPlayerName Expected element at argument 1,got string 'Mr.Pres[T]ege' !

Can you PM me the full code, so i can try to fix? (I hate trying to script, if i don't know what the result is :P )

Will the problem is the event not triggered i outputChatBox after trigger it but nothing !

Link to comment

humm, weird, im not sure, maybe:

addEvent("GetData",true) 
addEventHandler("GetData",getRootElement(), 
    function ( him ) 
        local Player = getPlayerFromName(him) 
        local Account = getPlayerAccount(Player) 
        if  Account then 
            local AccountName = getAccountName(Account) or "N/A" 
            local IP = getPlayerIP(Player) 
            local Serial = getPlayerSerial(Player) 
            local Health = getElementHealth(Player) 
            local Armor = getPedArmor(Player) 
            local Skin = getElementModel(Player) 
            local team = getPlayerTeam(Player) 
            if team then 
                local teamName = getTeamName(team) or "N/A" 
                local Money = getPlayerMoney(Player) 
                local x,y,z = getElementPosition(Player) 
                local Area = getZoneName ( x,y,z ) 
                local Dimenison = getElementDimension(Player) 
                local Interior = getElementInterior(Player) 
                if not isPedInVehicle(Player) then return end 
                local VehicleID = getElementModel(getPedOccupiedVehicle(Player)) 
                local VehicleName = getVehicleName(getPedOccupiedVehicle(Player)) 
                local VehicleHealth = getElementHealth(getPedOccupiedVehicle(Player)) 
                if ( Player and him and AccountName and IP and Serial and Health and Armor and Skin and teamName and Money and x and y and z and Area and Dimenison and Interior ) then 
                    triggerClientEvent(source,"SetTextSelectedPlayerInfo",source,Nick,AccountName,IP,Serial,Health,Armor,Skin,teamName,Money,x,y,z,Area,Dimenison,Interior,VehicleID,VehicleName,VehicleHealth) 
                end 
            end 
        end 
    end 
) 

Link to comment

Try this:

addEvent("GetData",true) 
addEventHandler("GetData",getRootElement(), 
function ( Player ) 
    local element = getPlayerFromName(Player) 
    local Nick = getPlayerName(element) 
    local Account = getPlayerAccount(element) 
    if  Account then 
    local AccountName = getAccountName(Account) or "N/A" 
    local IP = getPlayerIP(element) 
    local Serial = getPlayerSerial(element) 
    local Health = getElementHealth(element) 
    local Armor = getPedArmor(element) 
    local Skin = getElementModel(element) 
    local team = getPlayerTeam(element) 
    if team then 
    local teamName = getTeamName(team) or "N/A" 
    local Money = getPlayerMoney(element) 
    local x,y,z = getElementPosition(element) 
    local Area = getZoneName ( x,y,z ) 
    local Dimenison = getElementDimension(element) 
    local Interior = getElementInterior(element) 
    if isPedInVehicle(element) then 
        local VehicleID = getElementModel(getPedOccupiedVehicle(element)) 
        local VehicleName = getVehicleName(getPedOccupiedVehicle(element)) 
        local VehicleHealth = getElementHealth(getPedOccupiedVehicle(element)) 
    end 
    if ( element and Nick and AccountName and IP and Serial and Health and Armor and Skin and teamName and Money and x and y and z and Area and Dimenison and Interior ) then 
    triggerClientEvent(source,"SetTextSelectedPlayerInfo",source,Nick,AccountName,IP,Serial,Health,Armor,Skin,teamName,Money,x,y,z,Area,Dimenison,Interior,VehicleID,VehicleName,VehicleHealth) 
                end 
        end 
    end 
end 
) 

Link to comment
  
addEvent("GetData",true) 
addEventHandler("GetData",getRootElement(), 
function ( Player ) 
    local element = getPlayerFromName(Player) 
    local Nick = getPlayerName(element) 
    local Account = getPlayerAccount(element) 
    local AccountName = getAccountName(Account) or "N/A" 
    local IP = getPlayerIP(element) 
    local Serial = getPlayerSerial(element) 
    local Health = getElementHealth(element) 
    local Armor = getPedArmor(element) 
    local Skin = getElementModel(element) 
    local team = getPlayerTeam(element) 
    local teamName = getTeamName(team) or "N/A" 
    local Money = getPlayerMoney(element) 
    local x,y,z = getElementPosition(element) 
    local Area = getZoneName ( x,y,z ) 
    local Dimenison = getElementDimension(element) 
    local Interior = getElementInterior(element) 
    local VehicleID = getElementModel(getPedOccupiedVehicle(element)) or "N/A" 
    local VehicleName = getVehicleName(getPedOccupiedVehicle(element)) or "N/A" 
    local VehicleHealth = getElementHealth(getPedOccupiedVehicle(element)) or "N/A" 
    if ( element and Nick and AccountName and IP and Serial and Health and Armor and Skin and teamName and Money and x and y and z and Area and Dimenison and Interior ) then 
        triggerClientEvent(source,"SetTextSelectedPlayerInfo",source,Nick,AccountName,IP,Serial,Health,Armor,Skin,teamName,Money,x,y,z,Area,Dimenison,Interior,VehicleID,VehicleName,VehicleHealth) 
    end 
end 
) 

Link to comment

[2013-04-26 05:24:37] WARNING: MyAdmin\Server.lua:21: Bad argument @ 'getElementModel' [Expected element at argument 1, got boolean]

[2013-04-26 05:24:37] WARNING: MyAdmin\Server.lua:22: Bad argument @ 'getVehicleName'

[2013-04-26 05:24:37] WARNING: MyAdmin\Server.lua:23: Bad argument @ 'getElementHealth' [Expected element at argument 1, got boolean]

and getTeamName to !

Link to comment

If the player are not in a vehicle, getPedOccupiedVehicle will return false.

  
addEvent("GetData",true) 
addEventHandler("GetData",getRootElement(), 
function ( Player ) 
    local element = getPlayerFromName(Player) 
    local Nick = getPlayerName(element) 
    local Account = getPlayerAccount(element) 
    if (Account) then 
        local AccountName = getAccountName(Account) 
    else 
        local AccountName = "Not logged in" 
    end 
    local IP = getPlayerIP(element) 
    local Serial = getPlayerSerial(element) 
    local Health = getElementHealth(element) 
    local Armor = getPedArmor(element) 
    local Skin = getElementModel(element) 
    local team = getPlayerTeam(element) 
    if (team) then 
        local teamName = getTeamName(team) 
    else 
        local teamName = "N/A" 
    end 
    local Money = getPlayerMoney(element) 
    local x,y,z = getElementPosition(element) 
    local Area = getZoneName ( x,y,z ) 
    local Dimenison = getElementDimension(element) 
    local Interior = getElementInterior(element) 
    local vehicle = getPedOccupiedVehicle(element) 
    if (vehicle) then 
        local VehicleID = getElementModel(vehicle) 
        local VehicleName = getVehicleName(vehicle) 
        local VehicleHealth = getElementHealth(vehicle) 
    else 
        local VehicleID = "N/A" 
        local VehicleName = "N/A" 
        local VehicleHealth = "N/A" 
    end 
    if ( element and Nick and AccountName and IP and Serial and Health and Armor and Skin and teamName and Money and x and y and z and Area and Dimenison and Interior ) then 
        triggerClientEvent(source,"SetTextSelectedPlayerInfo",source,Nick,AccountName,IP,Serial,Health,Armor,Skin,teamName,Money,x,y,z,Area,Dimenison,Interior,VehicleID,VehicleName,VehicleHealth) 
    end 
end 
) 

Try it.

Link to comment
  
-- Client -- 
addEventHandler("onClientGUIClick",guiRoot, 
    function ( button , state , absoluteX , absoluteY ) 
    local Player = guiGridListGetItemText ( MyAdmin.gridlist[1], guiGridListGetSelectedItem ( MyAdmin.gridlist[1] ), 1 ) 
  
    if ( source == MyAdmin.gridlist[1] ) then 
  
    if ( guiGridListGetSelectedItem(MyAdmin.gridlist[1]) ~= -1 ) then  
        local elem = getPlayerFromName( Player ) 
        if elem then 
            triggerServerEvent("GetData",localPlayer,elem) 
        end  
    else 
        guiSetText(MyAdmin.label[2],"Nick : N/A") 
  
        guiSetText(MyAdmin.label[3],"Account Name : N/A") 
  
        guiSetText(MyAdmin.label[4],"IP : N/A") 
  
        guiSetText(MyAdmin.label[5],"Serial : N/A") 
  
        guiSetText(MyAdmin.label[6],"Verison : N/A") 
  
        guiSetText(MyAdmin.label[8],"Health  : N/A") 
  
        guiSetText(MyAdmin.label[9],"Armor  : N/A") 
  
        guiSetText(MyAdmin.label[10],"Skin : N/A") 
  
        guiSetText(MyAdmin.label[11],"Team  : N/A") 
  
        guiSetText(MyAdmin.label[13],"Money : N/A") 
  
        guiSetText(MyAdmin.label[14],"X : N/A") 
  
        guiSetText(MyAdmin.label[16],"Y : N/A") 
  
        guiSetText(MyAdmin.label[16],"Z : N/A") 
  
        guiSetText(MyAdmin.label[17],"Area : N/A") 
  
        guiSetText(MyAdmin.label[18],"Dimenison : N/A") 
  
        guiSetText(MyAdmin.label[19],"Interior : N/A") 
  
        guiSetText(MyAdmin.label[21],"Vehicle ID/Name : N/A") 
  
        guiSetText(MyAdmin.label[22],"Vehicle Health : N/A") 
  
        end 
  
    end 
  
end 
  
) 
  
  
  
addEvent("SetTextSelectedPlayerInfo",true) 
  
addEventHandler("SetTextSelectedPlayerInfo",getRootElement(), 
    function ( Nick,AccountName,IP,Serial,Health,Armor,Skin,teamName,Money,x,y,z,Area,Dimenison,Interior,VehicleID,VehicleName,VehicleHealth ) 
        guiSetText(MyAdmin.label[2],"Nick : "..Nick.." ") 
         
        guiSetText(MyAdmin.label[3],"Account Name : "..tostring( AccountName ).." ") 
         
        guiSetText(MyAdmin.label[4],"IP : "..IP.." ") 
         
        guiSetText(MyAdmin.label[5],"Serial : "..Serial.." ") 
         
        guiSetText(MyAdmin.label[6],"Verison : Soon ") 
         
        guiSetText(MyAdmin.label[8],"Health  : "..Health.." ") 
  
        guiSetText(MyAdmin.label[9],"Armor  : "..Armor.." ") 
  
        guiSetText(MyAdmin.label[10],"Skin : "..Skin.." ") 
  
        guiSetText(MyAdmin.label[11],"Team  : "..tostring( teamName ).." ") 
  
        guiSetText(MyAdmin.label[13],"Money : "..Money.." ") 
  
        guiSetText(MyAdmin.label[14],"X : "..x.." ") 
  
        guiSetText(MyAdmin.label[16],"Y : "..y.." ") 
  
        guiSetText(MyAdmin.label[16],"Z : "..z.." ") 
  
        guiSetText(MyAdmin.label[17],"Area : "..Area.." ") 
  
        guiSetText(MyAdmin.label[18],"Dimenison : "..Dimenison.." ") 
  
        guiSetText(MyAdmin.label[19],"Interior : "..Interior.." ") 
  
        guiSetText(MyAdmin.label[21],"Vehicle ID/Name : "..VehicleID.." | "..VehicleName.." ") 
  
        guiSetText(MyAdmin.label[22],"Vehicle Health : "..VehicleHealth.." ")    
  
    end 
  
) 
  
  
-- Server -- 
  
addEvent("GetData",true) 
addEventHandler("GetData",getRootElement(), 
function ( element ) 
    if not ( isElement( element ) ) then 
        return 
    end 
    local Nick = getPlayerName(element) 
    local Account = getPlayerAccount(element) 
    local AccountName = getAccountName(Account) 
    local IP = getPlayerIP(element) 
    local Serial = getPlayerSerial(element) 
    local Health = getElementHealth(element) 
    local Armor = getPedArmor(element) 
    local Skin = getElementModel(element) 
    local team = getPlayerTeam(element) 
    local teamName   
    if team then 
        teamName = getTeamName(team)  
    else 
        teamName =  "N/A"  
    end  
    local Money = getPlayerMoney(element) 
    local x,y,z = getElementPosition(element) 
    local Area = getZoneName ( x,y,z ) 
    local Dimenison = getElementDimension(element) 
    local Interior = getElementInterior(element) 
    local VehicleID 
    local VehicleName 
    local VehicleHealth  
    if isPedInVehicle(element) then 
        VehicleID = getElementModel(getPedOccupiedVehicle(element)) 
        VehicleName = getVehicleName(getPedOccupiedVehicle(element)) 
        VehicleHealth = getElementHealth(getPedOccupiedVehicle(element)) 
    else 
        VehicleID = 'Foot' 
        VehicleName = 'N/A' 
        VehicleHealth = 'N/ِA'      
    end 
    if ( isElement( element  ) and Nick and AccountName and IP and Serial and Health and Armor and Skin and teamName and Money and x and y and z and Area and Dimenison and Interior ) then 
        triggerClientEvent(source,"SetTextSelectedPlayerInfo",source,Nick,AccountName,IP,Serial,Health,Armor,Skin,teamName,Money,x,y,z,Area,Dimenison,Interior,VehicleID,VehicleName,VehicleHealth) 
    end 
end 
) 
  
  

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...