Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   Server flags (https://forums.graalonline.com/forums/showthread.php?t=66800)

Omini 06-21-2006 12:25 PM

Server flags
 
How am I meant to do something like this in GS2

PHP Code:

if (actionserverside) {
  if (
strequals(#p(0),takepoint)) {
    
replacestring serverr.zone#p(1),1,#v(strtofloat(#I(serverr.zone#p(1),1))-(1/120));
    
if (strtofloat(#I(serverr.zone#p(1),1))<=0) setstring serverr.zone#p(1),#g,0;
  
}
  if (
strequals(#p(0),addpoint)) {
    
replacestring serverr.zone#p(1),1,#v(strtofloat(#I(serverr.zone#p(1),1))+(.5/120));
    
if (strtofloat(#I(serverr.zone#p(1),1))>=100) replacestring serverr.zone#p(1),1,100;
  
}
}
//#CLIENTSIDE
if (created||timeout) {
if (
isonmap) {
  
showpoly 4000,{screenwidth-100,0,screenwidth,0,screenwidth,40,screenwidth-100,40};
  
changeimgvis 4000,4;
  if (
strequals(#g,)||!strcontains(#s(serverr.gangtags),#g)) changeimgcolors 4000,0,0,0,1;
  
elseif (strequals(#I(serverr.zone#v(int(playerx/((64*20)/5)))-#v(int(playery/((64*20)/5))),0),#g)) changeimgcolors 4000,0,1,0,1;
  
else changeimgcolors 4000,1,0,0,1;
  
showtext 5000,screenwidth-95,5,Arial,b,Owner#I(serverr.zone#v(int(playerx/((64*20)/5)))-#v(int(playery/((64*20)/5))),0);
  
changeimgzoom 5000,.5;changeimgvis 5000,5;changeimgcolors 5000,1,1,1,1;
  
showtext 5001,screenwidth-95,15,Arial,b,Points#v(int(strtofloat(#I(serverr.zone#v(int(playerx/((64*20)/5)))-#v(int(playery/((64*20)/5))),1))));
  
changeimgzoom 5001,.5;changeimgvis 5001,5;changeimgcolors 5001,1,1,1,1;
  }
  else 
hideimgs 4000,5001;
  if (
strcontains(#s(serverr.gangtags),#g)) {
    
if (isonmap) {
      
this.time+=.1;
      if (
this.time>=.5) {
        if (!
strequals(#I(serverr.zone#v(int(playerx/((64*20)/5)))-#v(int(playery/((64*20)/5))),0),#g)) triggeraction 0,0,serverside,-Systems/GangPoints,takepoint,#v(int(playerx/((64*20)/5)))-#v(int(playery/((64*20)/5)));
        
else triggeraction 0,0,serverside,-Systems/GangPoints,addpoint,#v(int(playerx/((64*20)/5)))-#v(int(playery/((64*20)/5)));
        
this.time=0;
      }
    } else 
this.time=0;
  }else 
this.time=0;
  
timeout=.1;


I don't know how I'm meant to get a retrived part of the string into it. I tried

PHP Code:

"Owner: "@serverr.zone@thiso.playerzonex@-@thiso.playerzoney@@; 

with
thiso.playerzonex = int(playerx/((64*20)/5));
thiso.playerzoney = int(playery/((64*20)/5));

Earlier in the script.

How do I do that in GS2?

ApothiX 06-21-2006 02:03 PM

This is where you use either makevar, or some weird use of the concatination operator and a few brackets.

makevar("serverr.zone" @ thiso.playerzonex - thiso.playerzoney);
serverr.("zone" @ thiso.playerzonex - thiso.playerzoney);

The latter is generally more approved by Stefan and most of the scripting community, I think it looks kind of odd though x_x

Omini 06-22-2006 12:07 PM

But the serverr string is something like
serverr.zone4-4

It doesn't take away thiso.playerzoney from thiso.playerzonex, so would that make it

serverr.("zone" @ thiso.playerzonex @ "-" @ thiso.playerzoney);

xXziroXx 06-22-2006 05:08 PM

Yes.

Omini 06-22-2006 06:36 PM

Thanks for your help =)


All times are GMT +2. The time now is 11:05 AM.

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