Advertisement
Guest User

Untitled

a guest
Feb 6th, 2014
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. // example of a simple bound function - a script that runs once
  2.  
  3. //bind with /registercommand "example_simple" "void BindFunction()" "Scripts/example_simple_bind.as" "example of simple script binding, turns all players into archers"
  4. // or from any script with registerScriptedCommand("example_simple", "void BindFunction()", "Scripts/example_simple_bind.as", "example of simple script binding, turns all players into archers");
  5. //call with /example_simple
  6.  
  7. void BindFunction()
  8. {
  9. for (int i = 0; i < getPlayerCount(); i++)
  10. {
  11. CPlayer@ player = getPlayer(i);
  12.  
  13. if (player is null) { continue; }
  14.  
  15. CBlob@ blob = player.getBlob();
  16.  
  17. if (blob is null) { continue; }
  18.  
  19. CBlob@ newBlob = server_CreateBlob("archer",0, blob.getPosition());
  20. newBlob.server_SetPlayer(player);
  21. blob.UnplugPlayer();
  22. blob.server_Die();
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement