Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 07-27-2012, 11:55 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
First off, have this code:
PHP Code:
function onActionServerSide(cmdtarget) {
  if (
cmd == "info") {
    
temp.pl findPlayerByCommunityName(target);
    if (
temp.pl == null) {
      
player.chat "(player not found");
      return;
    }

    
temp.level temp.pl.account " is in the level: " temp.pl.level.name;
    
temp.loc " X: " temp.pl."   Y: " temp.pl.y;

    
pl.triggerClient("gui"this.name"info"player.communityname);
    echo(
"Info Bot v2 - Level: " temp.level.name);
    echo(
"Info Bot v2 - X/Y: " temp.loc);
    echo(
"Info Bot v2 - Gralats: " temp.pl.gralats);
    echo(
"Info Bot v2 - ID: " temp.pl.id);
  }

I made some slight modifications. First, there's no reason to store stuff in variables if the referenced object doesn't even exist, so let's check that first. Next, both temp.pl and temp.pl.level are, in this case, objects. Nothing you should put into a string. Instead, let's use temp.pl.account and temp.pl.level.name. I believe that's it, but I'm rather tired right now..
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 06:37 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.