View Single Post
  #1  
Old 02-26-2011, 02:21 PM
Schetti Schetti is offline
SC2 Player
Schetti's Avatar
Join Date: Nov 2008
Location: Austria
Posts: 269
Schetti is on a distinguished road
Switch needed for triggerserver?

Do I need a switch command for triggerserver?
I tried to check the command via if-funktion, but that didn't work, can someone tell me why?
PHP Code:
function onActionserverside() 
{
   if (
params[0] == "summon")   //If instead of a switch
   
{
      
temp.pl = findplayerbycommunityname(params[1]);
      if (
pl != NULL) 
      {
       
pl.setlevel2(player.level, player.x, player.y);
       
pl.chat = format("", player.account);
       
player.chat = format("", pl.communityname);
      }else
    
player.chat = format("Community name '%s' not found!", params[1]);
   }
}
//#CLIENTSIDE
function onPlayerChats() 
{
   if (
player.chat.starts("/summon") && player.account != NULL) 
   {
    
triggerserver("gui", this.name, "summon", player.chat.substring(8));
   }
} 
__________________
“Peace cannot be kept by force. It can only be achieved by understanding.” – Albert Einstein
Reply With Quote