Author Topic: wtf is wrong with my script? [SOLVED]  (Read 927 times)

I'm trying to make to where every time a certain BL_ID connects, you are given, for instance, a prefix
I used my BL_ID in the script. Please tell me what the hell i did wrong

Quote
package Script_Check
{
   function GameConnection::LoadMission(%c,%a,%b,%d,%e,%f)
   {
      Parent::LoadMission(%c,%a,%b,%d,%e,%f);
      %client.oldPrefix = %client.clanPrefix;

      if(%client.bl_id == 42573)
      {
         %client.clanPrefix = "<color:8a8ae6>Dinosaur\c7" SPC %client.oldPrefix;
      }
   }
};
activatepackage(Script_Check);
« Last Edit: March 24, 2015, 06:56:24 PM by *LugNut* »

I don't see anything directly wrong, my guess is that GameConnection::loadMission is called too early. Instead I would use GameConnection::autoAdminCheck(%this) as the function to hook.

By the way, in the future just post your code instead of uploading the entire zip file. It's easier for us.

GameConnection::autoAdminCheck(%this) isnt that for Admins, if so, i want it to be just a regular player, not Admin
« Last Edit: March 23, 2015, 11:00:18 PM by *LugNut* »

isnt that for Admins, if so, i want it to be just a regular player, not Admin

It's the function that checks to see if they are auto admin, then if they are gives it to them. It gets called on everybody when they join.

package Script_Check
{
   function GameConnection::autoAdminCheck(%this)
   {
      Parent::LoadMission(%c,%a,%b,%d,%e,%f);
      %client.oldPrefix = %client.clanPrefix;

      if(%client.bl_id == 42573)
      {
         %client.clanPrefix = "<color:8a8ae6>Dinosaur\c7" SPC %client.oldPrefix;
      }
   }
};
activatepackage(Script_Check);
This didnt work either

Oh, I just figured out what's wrong with your code originally. The first parameter of LoadMission is the client, you have it named %c. Later on you try to check %client.bl_id but client is undefined, the client variable is %c. So you can either go back to your original code and change all the references to %client to %c, or you can still change to GameConnection::autoAdminCheck but you have to change your parent statement (Parent::loadMission(%c,%a,%b,%d,%e,%f)) to Parent::autoAdminCheck(%this). Beyond that, since we named the client variable %this in autoAdminCheck, you'd have to change the references to %client to %this.

Oh, I just figured out what's wrong with your code originally. The first parameter of LoadMission is the client, you have it named %c. Later on you try to check %client.bl_id but client is undefined, the client variable is %c. So you can either go back to your original code and change all the references to %client to %c, or you can still change to GameConnection::autoAdminCheck but you have to change your parent statement (Parent::loadMission(%c,%a,%b,%d,%e,%f)) to Parent::autoAdminCheck(%this). Beyond that, since we named the client variable %this in autoAdminCheck, you'd have to change the references to %client to %this.
It works, thanks a million

Also, getNumKeyID() returns your id, so you can compare %client.bl_id to that instead of a hardcoded "42573"