PaulDK Posted July 4, 2014 Share Posted July 4, 2014 i want to send armor in (id) but i can't ... here's the script ... Thanks in Advance ---------> function giveArmor ( p1, _, p2, id ) for _, group in ipairs ({"Admin", "Supermoderator","Console","Moderator"}) do local playerAccount = getPlayerAccount(p1) if (not playerAccount) then return end local accountName = getAccountName(playerAccount) if isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( group ) ) then if p2 then if tonumber(id) then target = getPlayerFromID(tonumber(p2)) else target = getPlayerFromName(p2) end setPedArmor(target, 100) outputChatBox("Given Armor", source, 255, 255, 255, true) return false end end end end addCommandHandler("armor", giveArmor) Link to comment
MTA Team botder Posted July 4, 2014 MTA Team Share Posted July 4, 2014 getPlayerFromID(...) Is not a MTA function. if tonumber(id) then target = getPlayerFromID(tonumber(p2)) else target = getPlayerFromName(p2) end Sense? Link to comment
PaulDK Posted July 6, 2014 Author Share Posted July 6, 2014 getPlayerFromID(...) Is not a MTA function. if tonumber(id) then target = getPlayerFromID(tonumber(p2)) else target = getPlayerFromName(p2) end Sense? but it's my first time doing in Giving in ID So I need help ---------> function giveArmor ( p1, _, p2, id, command ) for _, group in ipairs ({"Admin", "Supermoderator","Console","Moderator"}) do local playerAccount = getPlayerAccount(p1) if (not playerAccount) then return end local accountName = getAccountName(playerAccount) if isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( group ) ) then if p2 then if id then id = tonumber(p2) target = getPlayerByID(id) else target = getPlayerFromName(p2) end setPedArmor(target, 100) outputChatBox("Given Armor", source, 255, 255, 255, true) return false end end end end addCommandHandler("armor", giveArmor) Link to comment
PaulDK Posted July 7, 2014 Author Share Posted July 7, 2014 ANYONE HELP ME PLEASEEE ! I NEED HELP ... IF YOU HELP ME THANKS IF NOT THEN THANKS A LOT HELP ME IN MY SCRIPT . Link to comment
albers14 Posted July 7, 2014 Share Posted July 7, 2014 First of all your from DK? Next, there is no ID in MTA. So unless you had somewhere set the ID of the player then you cant do that stuff.. use getPlayerFromName instead, it finds the player element based on the name. Link to comment
PaulDK Posted July 7, 2014 Author Share Posted July 7, 2014 First of all your from DK? Next, there is no ID in MTA. So unless you had somewhere set the ID of the player then you cant do that stuff.. use getPlayerFromName instead, it finds the player element based on the name. I Have ID Script i just need to create how to give player in id ... Link to comment
Addlibs Posted July 7, 2014 Share Posted July 7, 2014 If this ID script works by setting element data 'id' to the actual player ID, add this function at the top of the file: function getPlayerFromID(id) for k,v in ipairs(getElementsByType("player")) do if getElementData(v, "id") == id then return v end end return false end Returns player element if found by ID, or false otherwise Link to comment
PaulDK Posted July 7, 2014 Author Share Posted July 7, 2014 If this ID script works by setting element data 'id' to the actual player ID, add this function at the top of the file: function getPlayerFromID(id) for k,v in ipairs(getElementsByType("player")) do if getElementData(v, "id") == id then return v end end return false end Returns player element if found by ID, or false otherwise No Works ... always ID was not Found this is the Script ------> function getPlayerFromID ( id ) for k, player in ipairs ( getElementsByType ( "player" ) ) do local p_id = getElementData ( player, "id" ) if ( p_id == tonumber(id) ) then player_n = getPlayerName ( player ) return player, player_n end end return false, "No player has been found with the ID " .. id .. "." end function giveArmor ( p1, _, p2, id) for _, group in ipairs ({"Admin", "Supermoderator","Console","Moderator"}) do local playerAccount = getPlayerAccount(p1) if (not playerAccount) then return end local accountName = getAccountName(playerAccount) if isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( group ) ) then if p2 then local targetz = getPlayerFromName(p2) if p2 then local targetz = getPlayerFromName ( p2 ) if targetz then local ID = tonumber(p2) if ID then target = getPlayerFromID(ID) else target = getPlayerFromName(p2) end local xplayer = getPlayerName ( p1 ) setPedArmor ( target, 100 ) outputChatBox ("#00FFFF[sERVER] "..xplayer.." #00FFFFgave you Armor.", ej, 255, 255, 255, true ) end else outputChatBox("#00FFFF[sERVER] #FF0000id or name are invalid ! ", p1, 255, 255, 255, true) end else outputChatBox("#00FFFF[sERVER] Please Use /givearmor [ id or name]", p1, 255, 255, 255, true) end end end end addCommandHandler ( "givearmor", giveArmor ) ANYONE PRO SCRIPTER HELP MEEEEE PLEASEEEEEEEEEE ! TO DONE THIS CRAZY THINGS ! TAPL Max+ Citizen Please Helppppp meeeeeee ! Link to comment
Et-win Posted July 7, 2014 Share Posted July 7, 2014 And do you also know where the script stops working? It would be ALOT easier if you know that. 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