Wei Posted May 27, 2012 Posted May 27, 2012 money_TAB = guiGridListAddColumn( GUIEditor_Grid[1], "Money", 0.10 ) guiGridListSetItemText ( GUIEditor_Grid[1], row, money_TAB, getPlayerMoney( cPlayer ), false, false ) cPlayer are all players
Alpha Posted May 27, 2012 Posted May 27, 2012 How come cPlayer is all players? Is it a table containing players?
Wei Posted May 27, 2012 Author Posted May 27, 2012 for index, cPlayer in pairs(getElementsByType( "player" )) do Yeah it is containing playerss
Alpha Posted May 27, 2012 Posted May 27, 2012 You have to loop through all players, and add a row for each player with his name: for index, cPlayer in pairs(getElementsByType( "player" )) do local row = guiGridListAddRow(GUIEditor_Grid[1]) guiGridListSetItemText ( GUIEditor_Grid[1], row, money_TAB, tostring(getPlayerMoney( cPlayer )), false, false ) end
Wei Posted May 27, 2012 Author Posted May 27, 2012 I have: function RefreshTab() guiGridListClear (GUIEditor_Grid[1]) for index, cPlayer in pairs(getElementsByType( "player" )) do row = guiGridListAddRow (GUIEditor_Grid[1]) guiGridListSetItemText ( GUIEditor_Grid[1], row, player_TAB, getPlayerName(cPlayer), false, false ) guiGridListSetItemText ( GUIEditor_Grid[1], row, money_TAB, getPlayerMoney( cPlayer ), false, false ) end end
Alpha Posted May 27, 2012 Posted May 27, 2012 (edited) I forgot, clientside getPlayerMoney can only get the money of the localPlayer. https://wiki.multitheftauto.com/wiki/GetPlayerMoney Edited May 27, 2012 by Guest
Stanley Sathler Posted May 27, 2012 Posted May 27, 2012 Alpha, but getPlayerMoney() also is server-side. Why it only gets the money of the localPlayer?
Alpha Posted May 27, 2012 Posted May 27, 2012 I meant clientside getPlayerMoney can only get the money of the localPlayer, while serverside can get any player's money.
Wei Posted May 28, 2012 Author Posted May 28, 2012 function createCarrou (hitPlayer) if getElementModel( hitPlayer ) == 28 then x, y, z = unpackCarjacker() vehicle = createVehicle ( 541,x, y, z ) carBlip = createBlipAttachedTo ( vehicle, 53 ) addEventHandler ( "onVehicleEnter", vehicle, carHit ) end end addCommandHandler("jacker", createCarrou) how can I make the blip visible only to the player ?
Guest Guest4401 Posted May 28, 2012 Posted May 28, 2012 If you are using this clientside then only that person will see it. If you are using it server side, then take a look at the visibleTo argument https://wiki.multitheftauto.com/wiki/Cre ... AttachedTo
Flaker Posted May 28, 2012 Posted May 28, 2012 function createCarrou (hitPlayer) if getElementModel( hitPlayer ) == 28 then x, y, z = unpackCarjacker() vehicle = createVehicle ( 541,x, y, z ) carBlip = createBlipAttachedTo ( vehicle, 53 ) addEventHandler ( "onVehicleEnter", vehicle, carHit ) end end addCommandHandler("jacker", createCarrou) how can I make the blip visible only to the player ? createBlipAttachedTo ( vehicle, 53, 2, 255, 0, 0, 255, 0, 99999.0, hitPlayer)
Castillo Posted May 28, 2012 Posted May 28, 2012 There's also a function called: setElementVisibleTo.
Anderl Posted May 28, 2012 Posted May 28, 2012 for index, cPlayer in PAIRS(getElementsByType( "player" )) do local row = guiGridListAddRow(GUIEditor_Grid[1]) guiGridListSetItemText ( GUIEditor_Grid[1], row, money_TAB, tostring(getPlayerMoney( cPlayer )), false, false ) end Did you see your error, Alpha?
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now