Author Topic: Need help with a script  (Read 1502 times)

Ok,im trying to make a script and its not working. Here it is

package start
{
function GameConnection::onClientEnterGame(%client)
{
tick(%client.name);
findClientByName(%client.name).player.client.instantRespawn();
}
};
activatePackage("start");

It stops people from loading when i use it
« Last Edit: March 30, 2009, 04:44:04 PM by halcynthis »

Ok, for one. What the forget is with that formatting? Also, try this.

Code: [Select]
function tick(%client)
{
commandToClient(%client,'bottomPrint',"\c6Cash:<color:FFFFFF>"SPC %a.cash);
schedule(100,"tick",%client);
}

Quote
function tick(%client)
{
   commandToClient(%client,'bottomPrint',"\c6Cash:<color:FFFFFF>" @ SPC %client.cash);
   schedule(1000,"tick",%client);
}
You might want to also raise the schedule to 1000 like I did, you don't really need to update that fast for a cash thingy.
« Last Edit: March 29, 2009, 10:30:59 PM by Destiny/Zack0Wack0 »

No, you don't put @ SPC, just SPC.

You guys miss such basic things...

Code: [Select]
function yourmod_tick(%client)
{
     if(!isObject(%client))
          return;

     bottomprint(%client,"\c6Cash: <color:FFFFFF> "@%client.cash,1,3);
     schedule(800,0,"yourmod_tick",%client);
}

Then call

Code: [Select]
yourmod_tick(findclientbyname("hal"));
You should try not to use such obvious function names like "tick" because it'll collide with mods made by people who did the same thing and it'll break stuff.
« Last Edit: March 30, 2009, 07:50:57 AM by Ephialtes »

The mod should automatically call the tick on all players once they have spawned.
Edit: And set the cash to 0 if it's blank, to stop the print from saying:
Cash:
till you have money.

Quote
package yourmod
{
   function GameConnection::onClientEnterGame(%this)
   {
      Parent::onClientEnterGame(%this);
      if(%this.cash $= "")
         %this.cash = 0;
      yourmod_tick(%this);
   }
};
activatePackage(yourmod);
« Last Edit: March 30, 2009, 03:09:34 PM by Chrono »

Fixed that,now i have a new error,posting code.

Try Parent::onClientEnterGame(%client) instead of instant respawn.

Code: [Select]
package start
{
function GameConnection::onClientEnterGame(%client)
{
tick(%client.name);
findClientByName(%client.name).player.client.instantRespawn();
}
Parent::onClientEnterGame(%client)
};
activatePackage("start");

halcynthis, read me and Ephi's posts, and you're good to go if you use both our codes together.

Code: [Select]
package start
{
function GameConnection::onClientEnterGame(%client)
{
tick(%client.name);
findClientByName(%client.name).player.client.instantRespawn();
}
Parent::onClientEnterGame(%client)
};
activatePackage("start");

Why do you even bother posting in Coding Help when you don't know what the hell you're doing? That crap you just posted is just going to give him more syntax errors and confuse him even more. Way to go.

Code: [Select]
findClientByName(%client.name).player.client.instantRespawn();
What?

What?

Pointless additions. Just needs %client.instantRespawn();

That's what I meant by "What?"

Didn't make much sense to me

package start
{
   function GameConnection::onClientEnterGame(%client)
   {
      tick(%client.name);
      findClientByName(%client.name).player.client.instantRespawn();
   }
Parent::onClientEnterGame(%client)
};
activatePackage("start");

Haha, thats hilarious.