HUNGRY:3 Posted August 4, 2015 Posted August 4, 2015 (edited) hello i'm trying to get the all of the player guns and put it in the gridlist but when i add another gun it doesn't go in code: client = getLocalPlayer() function addwep() local invrow = guiGridListAddRow(gridlist) local wep = getPedWeapon(client) if (wep) then guiGridListSetItemText ( gridlist, invrow, invcol, getWeaponNameFromID(wep), false, false ) else if guiGridListGetItemText (gridlist, invrow, invcol) == getWeaponNameFromID(wep) then guiGridListRemoveRow(gridlist,getWeaponNameFromID(wep)) end end end addEventHandler ( "onClientResourceStart", getRootElement(), addwep ) Edited August 4, 2015 by Guest
GTX Posted August 4, 2015 Posted August 4, 2015 You mean when you create a weapon for player, it doesn't show in the grid list? That's because you have to refresh the grid list.
HUNGRY:3 Posted August 4, 2015 Author Posted August 4, 2015 First it doesn't get all of the player weapons Second i did something to refresh it but it get spammed in the grid
HUNGRY:3 Posted August 4, 2015 Author Posted August 4, 2015 You mean like it duplicates? Use guiGridListClear thank you it gave me an idea
HUNGRY:3 Posted August 4, 2015 Author Posted August 4, 2015 but... how to get all of the player weapons? and make them go in the gridlist? is there any way?
GTX Posted August 4, 2015 Posted August 4, 2015 There are 12 slots (including 0) and with second argument on getPedWeapon you can make that. for i=0, 12 do outputChatBox(getPedWeapon(player, i)) end
HUNGRY:3 Posted August 4, 2015 Author Posted August 4, 2015 all of them are 0 function test(player) for i=0, 12 do outputChatBox(getPedWeapon(player, i)) end end addCommandHandler("seeguns",test)
HUNGRY:3 Posted August 4, 2015 Author Posted August 4, 2015 Ok GTX one more question i did some thing in the script that gets the weapon name not the id but the question is i want to change "fist" in grid to "none" which function should i use and which event? Thanks.
GTX Posted August 4, 2015 Posted August 4, 2015 (edited) You can compare strings like: if getWeaponIDFromName(int) == "Fist" then str = "None" end Edited August 5, 2015 by Guest
HUNGRY:3 Posted August 5, 2015 Author Posted August 5, 2015 You can compare strings like: if getWeaponFromName(int) == "Fist" then str = "None" end thanks but getWeaponFromName Doesn't exist but I changed it and it works
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