Wei Posted May 27, 2012 Share 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 Link to comment
Alpha Posted May 27, 2012 Share Posted May 27, 2012 How come cPlayer is all players? Is it a table containing players? Link to comment
Wei Posted May 27, 2012 Author Share Posted May 27, 2012 for index, cPlayer in pairs(getElementsByType( "player" )) do Yeah it is containing playerss Link to comment
Alpha Posted May 27, 2012 Share 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 Link to comment
Wei Posted May 27, 2012 Author Share 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 Link to comment
Alpha Posted May 27, 2012 Share 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 Link to comment
Stanley Sathler Posted May 27, 2012 Share Posted May 27, 2012 Alpha, but getPlayerMoney() also is server-side. Why it only gets the money of the localPlayer? Link to comment
Alpha Posted May 27, 2012 Share Posted May 27, 2012 I meant clientside getPlayerMoney can only get the money of the localPlayer, while serverside can get any player's money. Link to comment
Spajk Posted May 27, 2012 Share Posted May 27, 2012 becouse this script is client side ( GUIs ) Link to comment
Wei Posted May 28, 2012 Author Share 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 ? Link to comment
Guest Guest4401 Posted May 28, 2012 Share 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 Link to comment
Flaker Posted May 28, 2012 Share 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) Link to comment
Castillo Posted May 28, 2012 Share Posted May 28, 2012 There's also a function called: setElementVisibleTo. Link to comment
Anderl Posted May 28, 2012 Share 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? Link to comment
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