Schlammy Posted May 1, 2012 Share Posted May 1, 2012 Hey Guys I have a big Problem! In my script there is a GUI which I can open but there i made a row called Wanteds and Spieler which means the Player. So I made that in the Player row the Playername will be and in the Wanted row the wanteds of the Player but this is not working every number in the row Wanted shows only my current wanted by every player. I dont understand this Pleas help GUIEditor_Window = {} blipState = false user1 = {"Schlammy","TheGamer"} _setPlayerWantedLevel = setPlayerWantedLevel function isValidPlayer() local playerName = getPlayerName(localPlayer) for index, value in ipairs(user1) do if value == playerName then return true end end return false end -- HIER -- --[[ function onClientPlayerWeaponFireFunc(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitPlayer) local derzombie = getElementData if getElement (source, "zombie") then killPed ("zombie") end -- Add this as a handler so that the function will be triggered every time a player fires. addEventHandler("onClientPlayerWeaponFire", root, onClientPlayerWeaponFireFunc) -- HIER ]]-- function gui() GUIEditor_Window[1] = guiCreateWindow(265,276,340,519,"Navy Seal",false) Label_1_Deine_Auswahl = guiCreateLabel(36,43,125,17,"Deine Auswahl:",false,GUIEditor_Window[1]) Button1_Agent_on = guiCreateButton(33,65,154,45,"Duty",false,GUIEditor_Window[1]) gridList = guiCreateGridList(33,259,275,238,false,GUIEditor_Window[1]) guiGridListSetSelectionMode(Gridlist, 0) Label_2_Wanted_Liste = guiCreateLabel(114,236,144,21,"Wanted Liste",false,GUIEditor_Window[1]) Button2_Agent_off = guiCreateButton(33,116,154,45,"Off Duty",false,GUIEditor_Window[1]) guiGridListAddColumn(gridList, "Spielername", 0.7) guiGridListAddColumn(gridList, "Wanted", 0.2) addEventHandler("onClientGUIClick", Button1_Agent_on, speichern) addEventHandler("onClientGUIDoubleClick", gridList, showPositionAtMap, false) addEventHandler("onClientGUIClick", Button2_Agent_off, ausgeben) guiSetVisible(GUIEditor_Window[1], false) end function handle() if isValidPlayer() then if GUIEditor_Window[1] == nil then gui() end if GUIEditor_Window[1] ~= nil then guiSetVisible(GUIEditor_Window[1], true) guiGridListClear(gridList) showCursor(true) for index, spieler in pairs(getElementsByType("player")) do local row = guiGridListAddRow(gridList) guiGridListSetItemText(gridList, row, 1, getPlayerName(spieler), false, false) guiGridListSetItemText(gridList, row, 2, tonumber(getPlayerWantedLevel(spieler)), false, false) end end end end bindKey ("num_1", "down", handle) function speichern(button,state) if button == "left" and state == "up" then triggerServerEvent("saveWeapons", root) dername = getPlayerName(getLocalPlayer()) Skin = getElementModel(getLocalPlayer()) guiSetVisible(GUIEditor_Window[1], false) showCursor(false) end end function ausgeben(button,state) if button == "left" and state == "up" then triggerServerEvent("regiveWeapons", root, Skin, dername) guiSetVisible(GUIEditor_Window[1], false) showCursor(false) end end function showPositionAtMap(button, state) if button == "left" and state == "up" then if blipState == false then local name = guiGridListGetItemText(gridList, guiGridListGetSelectedItem(gridList), 1) local player = getPlayerFromName(name) if player then local px, py, pz = getElementPosition(player) blip = createBlipAttachedTo(player,56) blipState = true end else destroyElement(blip) blipState = false end end end function setPlayerWantedLevel(player, level) local name = getPlayerName(player) setPlayerNametagText(player, name.."("..level..")") return _setPlayerWantedLevel(player, level) end function beenden(player) guiSetVisible(GUIEditor_Window[1], false) showCursor(false) end addCommandHandler("endgui", beenden) Link to comment
Castillo Posted May 2, 2012 Share Posted May 2, 2012 That's because getPlayerWantedLevel client side only returns the local player wanted level, it has no arguments. Link to comment
Schlammy Posted May 2, 2012 Author Share Posted May 2, 2012 I think there is a server trigger event needed can you write me what I have to write in the server.lua and what into the gui.lua?? Link to comment
Castillo Posted May 2, 2012 Share Posted May 2, 2012 You must trigger a server side event with triggerServerEvent and add the event server side with addEvent and addEventHandler, then trigger back the value with triggerClientEvent. 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