Clydian Posted July 23, 2015 Posted July 23, 2015 (edited) function givePlayerBadge(thePlayer, commandName, targetPlayer, ... ) local badgeNumber = table.concat( { ... }, " " ) badgeNumber = #badgeNumber > 0 and badgeNumber local theTeam = getPlayerTeam(thePlayer) local teamID = getElementData(theTeam, "id") local badge = nil local itemID = nil local prefix = "" for k, v in pairs(badges) do for ka, va in pairs(v[3]) do if ka == teamID then badge = v itemID = k prefix = type(va) == "string" and ( va .. " " ) or "" end end end if not badge then return end local leader = getElementData(thePlayer, "factionleader") if not (tonumber(leader)==1) then outputChatBox("You must be a faction leader to issue badges.", thePlayer, 255, 0, 0) else if not targetPlayer or not badgeNumber then outputChatBox("SYNTAX: /" .. commandName .. " [Player Partial Nick / ID] [badge Number]", thePlayer, 255, 194, 14) else local targetPlayer, targetPlayerName = exports.global:findPlayerByPartialNick(thePlayer, targetPlayer) if targetPlayer then local targetPlayerName = targetPlayerName:gsub("_", " ") local logged = getElementData(targetPlayer, "loggedin") if (logged==0) then outputChatBox("Player is not logged in.", thePlayer, 255, 0, 0) else local x, y, z = getElementPosition(thePlayer) local tx, ty, tz = getElementPosition(targetPlayer) if (getDistanceBetweenPoints3D(x, y, z, tx, ty, tz)>4) then outputChatBox("You are too far away to issue this player a badge.", thePlayer, 255, 0, 0) else exports.global:sendLocalMeAction(thePlayer, "issues "..targetPlayerName.." " .. badge[2] .. ", reading " .. badgeNumber .. ".") exports.global:giveItem(targetPlayer, itemID, prefix .. badgeNumber) end end end end end end addCommandHandler("issuebadge", givePlayerBadge, false, false) Has anybodey have any ideas why this doesnt work? Edited July 23, 2015 by Guest
Clydian Posted July 23, 2015 Author Posted July 23, 2015 any error in debugscript 3? Cant tell.. Cause theres a lot of diffrent thing popping up EDIT: Nope, just checked, nothing there
Clydian Posted July 23, 2015 Author Posted July 23, 2015 Oh, and i want to know if theres a way, to turn my mapping in createObject file
Clydian Posted July 24, 2015 Author Posted July 24, 2015 http://gtamap.delux-host.com/converter/ Any suggestions about the script?
xeon17 Posted July 24, 2015 Posted July 24, 2015 'Doesn't work' If you want to be helped, then help us to help you. Give us some more information about the problem, your code have more than 50 lines. What exactly doesn't work?
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