Jump to content

Help pls


TheIceman1

Recommended Posts

Posted

Why this dont show me(name,team,gang,role...) on labels?No errors

function setplayerinf() 
local playerName = guiGridListGetItemText ( GUIEditor_Grid[1], guiGridListGetSelectedItem ( GUIEditor_Grid[1] ), 1 ) 
local name = getPlayerName( playerName ) 
local team = getPlayerTeam( playerName ) 
local role = getElementData( playerName, "Role" ) 
local gang = getElementData ( playerName, "gang" ) 
local wl = getPlayerWantedLevel ( playerName ) 
guiSetText ( GUIEditor_Label[5], "WantedLevel:"..wl ) 
guiSetText ( GUIEditor_Label[1], "Name:"..name ) 
guiSetText ( GUIEditor_Label[2], "Team:"..team ) 
guiSetText ( GUIEditor_Label[3], "Role:"..role ) 
guiSetText ( GUIEditor_Label[6], "Gang:"..gang ) 
end 
addEventHandler ( "onClientGUIclick", GUIEditor_Button[1], setplayerinf ) 

Need paid scripter just pm me i will accept every job!

Posted
Why this dont show me(name,team,gang,role...) on labels?No errors
function setplayerinf() 
local playerName = guiGridListGetItemText ( GUIEditor_Grid[1], guiGridListGetSelectedItem ( GUIEditor_Grid[1] ), 1 ) 
local name = getPlayerName( playerName ) 
local team = getPlayerTeam( playerName ) 
local role = getElementData( playerName, "Role" ) 
local gang = getElementData ( playerName, "gang" ) 
local wl = getPlayerWantedLevel ( playerName ) 
guiSetText ( GUIEditor_Label[5], "WantedLevel:"..wl ) 
guiSetText ( GUIEditor_Label[1], "Name:"..name ) 
guiSetText ( GUIEditor_Label[2], "Team:"..team ) 
guiSetText ( GUIEditor_Label[3], "Role:"..role ) 
guiSetText ( GUIEditor_Label[6], "Gang:"..gang ) 
end 
addEventHandler ( "onClientGUIclick", GUIEditor_Button[1], setplayerinf ) 

why are you using playerName, and not getLocalPlayer()?

local name = getPlayerName( getLocalPlayer() ) 
local team = getPlayerTeam(  getLocalPlayer() ) 
local role = getElementData(  getLocalPlayer() , "Role" ) 
local gang = getElementData (  getLocalPlayer() , "gang" ) 

or if you want to get it from a gridview list, just get the data out of the row you selected. Much easier.

logo-small.png?v=3 tiny-sapdfr.png

 

If you want to contact me directly concerning Advanced-Gaming, please contact me at [email protected]

Posted

To get the data of the selected player you must use getPlayerFromName.

function setplayerinf ( ) 
    local row, col = guiGridListGetSelectedItem ( GUIEditor_Grid[1] ) 
    if ( row and col and row ~= -1 and col ~= -1 ) then 
        local playerName = guiGridListGetItemText ( GUIEditor_Grid[1], row, 1 ) 
        local player = getPlayerFromName ( playerName ) 
        if ( player ) then 
            local name = getPlayerName( player ) 
            local team = getPlayerTeam( player ) 
            local role = getElementData( player, "Role" ) 
            local gang = getElementData ( player, "gang" ) 
            local wl = getPlayerWantedLevel ( player ) 
            guiSetText ( GUIEditor_Label[5], "WantedLevel:"..wl ) 
            guiSetText ( GUIEditor_Label[1], "Name:"..name ) 
            guiSetText ( GUIEditor_Label[2], "Team:"..team ) 
            guiSetText ( GUIEditor_Label[3], "Role:"..role ) 
            guiSetText ( GUIEditor_Label[6], "Gang:"..gang ) 
        end 
    end 
end 
addEventHandler ( "onClientGUIclick", GUIEditor_Button[1], setplayerinf, false ) 

The wanted level part won't work, because getPlayerWantedLevel returns the local player wanted level if you use it client side, you can't get a remote player's wanted level.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
To get the data of the selected player you must use getPlayerFromName.
function setplayerinf ( ) 
    local row, col = guiGridListGetSelectedItem ( GUIEditor_Grid[1] ) 
    if ( row and col and row ~= -1 and col ~= -1 ) then 
        local playerName = guiGridListGetItemText ( GUIEditor_Grid[1], row, 1 ) 
        local player = getPlayerFromName ( playerName ) 
        if ( player ) then 
            local name = getPlayerName( player ) 
            local team = getPlayerTeam( player ) 
            local role = getElementData( player, "Role" ) 
            local gang = getElementData ( player, "gang" ) 
            local wl = getPlayerWantedLevel ( player ) 
            guiSetText ( GUIEditor_Label[5], "WantedLevel:"..wl ) 
            guiSetText ( GUIEditor_Label[1], "Name:"..name ) 
            guiSetText ( GUIEditor_Label[2], "Team:"..team ) 
            guiSetText ( GUIEditor_Label[3], "Role:"..role ) 
            guiSetText ( GUIEditor_Label[6], "Gang:"..gang ) 
        end 
    end 
end 
addEventHandler ( "onClientGUIclick", GUIEditor_Button[1], setplayerinf, false ) 

The wanted level part won't work, because getPlayerWantedLevel returns the local player wanted level if you use it client side, you can't get a remote player's wanted level.

Nothing happens.

Need paid scripter just pm me i will accept every job!

Posted

But why this doesn't shows player team?

function setplayerinf ( ) 
    local row, col = guiGridListGetSelectedItem ( GUIEditor_Grid[1] ) 
    if ( row and col and row ~= -1 and col ~= -1 ) then 
        local playerName = guiGridListGetItemText ( GUIEditor_Grid[1], row, 1 ) 
        local player = getPlayerFromName ( playerName ) 
        if ( player ) then 
            local name = getPlayerName( player ) 
            local team = getPlayerTeam ( player ) 
            local tname = getTeamName ( team ) 
            local role = getElementData( player, "Role" ) 
            local gang = getElementData ( player, "gang" ) 
            guiSetText ( GUIEditor_Label[1], "Name:"..name ) 
            guiSetText ( GUIEditor_Label[2], "Team:"..tname ) 
            guiSetText ( GUIEditor_Label[3], "Role:"..role ) 
            guiSetText ( GUIEditor_Label[6], "Gang:"..gang ) 
        end 
    end 
end 
addEventHandler ( "onClientGUIClick", GUIEditor_Grid[1], setplayerinf, false ) 

Need paid scripter just pm me i will accept every job!

Posted

The player has a team?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Do you get any error on debugscript? since this a client side script, the error won't appear on the server console.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
Do you get any error on debugscript? since this a client side script, the error won't appear on the server console.

Fixed.

Need paid scripter just pm me i will accept every job!

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