myonlake Posted November 17, 2012 Share Posted November 17, 2012 Perhaps look at your own script before asking for help for every single thing you need. Client-side addEvent("onClientPlayerSerialFetched", true) addEventHandler("onClientPlayerSerialFetched", root, function(serial) guiSetText(aSerial, "Serial: " .. serial) end ) addEventHandler("onClientGUIClick", aGrid, function() local pRow = guiGridListGetSelectedItem(aGrid) if (pRow and pRow ~= -1) then triggerServerEvent("onClientPlayerSerialRequested", localPlayer, guiGridListGetItemText(aGrid, pRow, 1)) end end ) Server-side function findPlayer(name, player) if name == "*" and getElementType(player) == "player" and not isGuestAccount(getPlayerAccount(player)) then return player else local matches = {} for i,v in ipairs(getElementsByType("player")) do if getPlayerName(v) == name and not isGuestAccount(getPlayerAccount(v)) then return v end local playerName = getPlayerName(v):gsub("#%x%x%x%x%x%x", "") playerName = playerName:lower() if playerName:find(name:lower(), 0) and not isGuestAccount(getPlayerAccount(v)) then table.insert(matches, v) end end if #matches == 1 then return matches[1] end return false end end addEvent("onClientPlayerSerialRequested", true) addEventHandler("onClientPlayerSerialRequested", root, function(player) local target = findPlayer(player, source) if target then triggerClientEvent(source, "onClientPlayerSerialFetched", source, getPlayerSerial(getPlayerFromName(target))) else outputChatBox("DEBUG: 'onClientPlayerSerialRequested' returned false.", source, 245, 40, 40, false) end end ) Link to comment
manve1 Posted November 17, 2012 Author Share Posted November 17, 2012 I do look at it, i try few times, i ask help when i never used them and i fail at them, or with something that would be impossible to make for me Link to comment
myonlake Posted November 17, 2012 Share Posted November 17, 2012 You only had to change one line of code above there. Well did it work or not? Link to comment
myonlake Posted November 17, 2012 Share Posted November 17, 2012 Huh? Boolean value can be true or false, your post doesn't tell me whether is works or not. Any errors in debug? Link to comment
manve1 Posted November 17, 2012 Author Share Posted November 17, 2012 only error i get is this: ERROR: attempt to concatenate local 'serial' ( a boolean value ) Link to comment
myonlake Posted November 17, 2012 Share Posted November 17, 2012 Replace the below code with the one you can find from the script. Server-side triggerClientEvent(source, "onClientPlayerSerialFetched", source, getPlayerSerial(target)) Link to comment
manve1 Posted November 17, 2012 Author Share Posted November 17, 2012 yep, worked, ty Link to comment
myonlake Posted November 17, 2012 Share Posted November 17, 2012 You're welcome, but as a pro-tip, I suggest that you should always go through the code many times yourself and look at what's wrong, it is very simple to notice that something is wrong. This way you can prevent mass posts. 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