PaulDK Posted June 21, 2014 Posted June 21, 2014 hey guys help me i want to give armor in other player by using [id] but i can't always invalid id or name . help me guys please thanks ---> id script avaibleID = { } players = { } addEventHandler( 'onResourceStart', getResourceRootElement( ), function( ) call( getResourceFromName( 'scoreboard' ), 'scoreboardAddColumn', 'id', getRootElement( ), 20, 'ID', 1 ) end ) function createPlayerID( player ) setPlayerID( player, 0 ) end function setPlayerID( player, id ) local pID = id + 1 if pID then if avaibleID[pID] ~= false then avaibleID[pID] = false players[pID] = player setElementData( player, 'id', pID ) else return setPlayerID( player, pID ) end end end function destroyPlayerID( player ) local pID = tonumber( getElementData( player, 'id' ) ) if pID then avaibleID[pID] = nil players[pID] = nil end end function getPlayerID( player ) if player then local pID = tonumber( getElementData( player, 'id' ) ) if pID then return tonumber( pID ) end end end function getPlayerByID( id ) if tonumber( id ) then local player = players[id] return player end end addEvent( 'downloadEnd', true ) addEventHandler( 'downloadEnd', getRootElement( ), function( ) createPlayerID( source ) end ) ----> armor script function giveArmor ( p1, _, p2 ) 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 targetz then local ID = tonumber(p2) if ID then target = ( getElementData(p2, 'id') ) else target = getPlayerFromName(p2) end if target then local xplayer = getPlayerName ( p1 ) setElementHealth ( targetz, 100 ) outputChatBox ("#00FFFF[sERVER] "..xplayer.." #00FFFFGave you Health.", 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 /givehealth [ id or name]", p1, 255, 255, 255, true) end end end end addCommandHandler ( "givearmor", giveArmor ) Thanks in Advance
Mr.unpredictable. Posted June 21, 2014 Posted June 21, 2014 this adds an amount of armor that the player defined in command 'addarmor'. function givePlayerArmor( player, command, amount ) if getPedArmor(player) == 100 then return outputChatBox("Your armor already is complete!", player, 220, 0, 0 ) -- Inform the player if your armor already is complete. end if amount and tonumber(amount) >= 1 or tonumber(amount) <= 100 then -- If amount is between 1 and 100. setPedArmor( player, tonumber(amount) ) -- Set amount armor that player chosen on the command. else return end if not amount then outputChatBox( "sintax: /addarmor [armor-amount]", player, 220, 0, 0 ) -- Inform the player if 'amount' argument is missing. end end addCommandHandler( "addarmor", givePlayerArmor ) https://wiki.multitheftauto.com/wiki/SetPedArmor
PaulDK Posted June 21, 2014 Author Posted June 21, 2014 this adds an amount of armor that the player defined in command 'addarmor'. function givePlayerArmor( player, command, amount ) if getPedArmor(player) == 100 then return outputChatBox("Your armor already is complete!", player, 220, 0, 0 ) -- Inform the player if your armor already is complete. end if amount and tonumber(amount) >= 1 or tonumber(amount) <= 100 then -- If amount is between 1 and 100. setPedArmor( player, tonumber(amount) ) -- Set amount armor that player chosen on the command. else return end if not amount then outputChatBox( "sintax: /addarmor [armor-amount]", player, 220, 0, 0 ) -- Inform the player if 'amount' argument is missing. end end addCommandHandler( "addarmor", givePlayerArmor ) https://wiki.multitheftauto.com/wiki/SetPedArmor that is amount i dont need it i want if you type /givearmor [id] it will gives full armor in that id number my problem is my givearmor script doesn't function well .
xeon17 Posted June 21, 2014 Posted June 21, 2014 addEvent( 'downloadEnd', true ) addEventHandler( 'downloadEnd', getRootElement( ), function( ) createPlayerID( source ) end ) WHAT ?
PaulDK Posted June 22, 2014 Author Posted June 22, 2014 addEvent( 'downloadEnd', true )addEventHandler( 'downloadEnd', getRootElement( ), function( ) createPlayerID( source ) end ) WHAT ? It's Working 100% bro -.- i need how to give armor in [id] .
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