Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   How come this doesnt even work (https://forums.graalonline.com/forums/showthread.php?t=134264588)

Astram 09-18-2011 10:37 PM

How come this doesnt even work
 
What do you see wrong with this? It doesnt make the DBNPC's flags ANY DIFFERENT or my chat...

Weapon: -Staff/Jailer
PHP Code:

findplayer("Graal749201").addweapon(this.name);
//#CLIENTSIDE
function onCreated() {
  
this.guilds = {"Graal Police","Player Relations","Graal Police Admin","Player Relations Admin","Manager","Co-Manager","Owner","Co-Owner"};
}
function 
onPlayerChats() {
  if (
player.chat.starts("/jail") && player.guild in this.guilds) {
    
temp.tokens player.chat.tokenize();
    
temp.jailed tokens[1];
    
temp.time tokens[2];
    
temp.reason tokens[3];
    
triggerserver"npc""JailDB""JailPlayer"temp.jailedtemp.timetemp.reason);
  }


DB NPC: JailDB
PHP Code:

function onActionServerSide() {
  if (
params[0] == "JailPlayer") {
    
player.chat "Jailed: "@params[1];
    
JailDB.injail.add(params[1SPC player.account);
    
JailDB.(params[1]@"_JailTime") = params[2];
    
JailDB.(params[1]@"_Jailer") = player.account;
    
JailDB.(params[1]@"_JailReason") = params[3];
    
with(findplayer(params[1])) {
      
clientr.jailtime "";
      
addweapon("-System/Jailed");
      
//Get Mins Converted To Seconds
      
clientr.jailtime params[2] * 60;
    }
  }



fowlplay4 09-18-2011 10:44 PM

I could of sworn you were told this before but:

Put your "guild checking" on the server-side.

PHP Code:

function onCreated() {
  
this.guilds = {"Graal Police","Player Relations","Graal Police Admin","Player Relations Admin","Manager","Co-Manager","Owner","Co-Owner"};
}

function 
onActionServerSide() {
  if (
params[0] == "JailPlayer") {
    if (
player.guild in this.guilds) {
      
// do your jailing stuff..
    
}
  }


Can't really tell you why it's not working but why not just keep your onActionServerSide code in your weapon?


All times are GMT +2. The time now is 07:30 PM.

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