Jump to content

setElementData


Recommended Posts

Posted

Hey, how could i make a command that sets a players ElementData named "level" to whichever number is specified?

for example, if I typed it '/level Fontaine 100' ingame, it would set Fontaine's level to 100.

Any help is appreciated!

560x95_FFFFFF_FF9900_000000_000000.png
Posted (edited)
addCommandHandler("level", function(cmdSrc, cmd, player, level) 
  local pla = getPlayerFromName(player) 
  if player and pla then 
    if level and tonumber(level) then 
       setElementData(pla, "level", tonumber(level)) 
       outputChatBox("Set "..getPlayerName(pla).."'s level to "..tonumber(level), cmdSrc, 0, 255, 0) 
    else 
      outputChatBox("Error: Invalid level specified.", cmdSrc, 255, 0, 0) 
    end 
  else 
    outputChatBox("Error: Player '"..player.."' not found.", cmdSrc, 255, 0, 0) 
  end 
end) 

Edited by Guest

Previously known as MrTasty.

Posted
addCommandHandler("level", function(cmdSrc, cmd, player, level) 
  local pla = getPlayerFromName(player) 
  if player and pla then 
    if level and tonumber(level) then 
       setElementData(pla, "level", tonumber(level)) 
       outputChatBox("Set "..getPlayerName(pla).."'s level to "..tonumber(level), cmdSrc, 0, 255, 0) 
    else 
      outputChatBox("Error: Invalid level specified.", cmdSrc, 255, 0, 0) 
    end 
  else 
    outputChatBox("Error: Player '"..player.."' not found.", cmdSrc, 255, 0, 0) 
  end 
end 

Worng , you have many mistakes ,

- New , Kill System

- New, GameMode Intro

- Leve / Exp System

- New nametag showing style

- New , Hud For Players

- Skin Selection from SA-MP

- Money System / Buy Weapons

- Drop Weapons

- New, Flood System

- New , Group Assign

- Gun license For Weapons

- Random Rule System For Money

Posted
  
function setLevel(player,cmd,player2,level) 
    if hasObjectPermissionTo(player,"function.kickPlayer") then 
        if player2 and level then 
            if tonumber(level) then 
                local plyElement = getPlayerFromName(player2) 
                if plyElement then 
                    setElementData(plyElement,"level",level) 
                    outputChatBox("You have successfuly changed the level of "..player2.." to "..level..".",player,200,100,100) 
                    outputChatBox("Your Level was changed to "..level.." By "..player..".",player2,200,100,100) 
                    else outputChatBox("Player Not Found.",player,200,100,100) 
                end 
                else outputChatBox("Invaild Level.",player,200,100,100) 
            end 
            else outputChatBox("setlevel: Syntax /setlevel  ",200,100,100) 
        end 
    end 
end 
addCommandHandler("setlevel",setLevel) 
  

Ingame Name: Arnold

If you need my help, contact me on Skype @bshr.ara

NOTE:DO NOT ASK ME FOR SCRIPTS, ASK ME FOR HELP

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...