Es.sexec
From EventScripts Community Encyclopedia
[edit] Method: sexecModule: es [edit] Method Overview[edit] Table of Contents
[edit] Syntax{{{syntax}}} [edit] Arguments
[edit] DescriptionForces a userid to execute a command on the server console (bypassing client console). This is the Python equivalent of: http://www.eventscripts.com/pages/es_sexec [edit] Exampleses.sexec("4", "kill") import es import playerlib def load(): # Check to see if the say command exists if not es.exists('saycommand', 'slap'): # Register the say command to the function block! es.regsaycmd('slap', 'healthyaddon/slap') def slap(): # Players name name = es.getargv(1) # Amount of health to deduct amount = es.getargv(2) # Grab userid from the name userid = es.getuserid(name) # Check to see if there is such a player! if userid <= 0: # Inform the abuser that there is no such name! :) es.tell(es.getcmduserid(), name + " does not exists.. try gain? :P") # Else create PAIN! else: # Use the playerlib to help us hurt the player player = playerlib.getPlayer(userid) # Get the current health curhealth = player.attributes["health"] # Remove all armor.. You don't have to do this though. player.set("armor", "0") # Calculate the new health newhealth = int(curhealth) - int(amount) # Set the new health! player.set("health", str(newhealth)) # Check to see if the player has any health left. If not.. Kill Muwhahaha if newhealth <= 0: # Execute the kill command! :D es.sexec(userid, "kill") [edit] Notes
[edit] See Also |
|
