Author Topic: SpeedKart Achievements script and GUI  (Read 2892 times)

I know how make custom gui.
How I can make a client gui at my server without player download of my add ons, when player join my server and automatic gui pop up for players?
« Last Edit: February 17, 2013, 06:09:34 AM by Furling² »

 not happening.  your need at least a mod to accept guis from the server,  and doing that wrong will get it fail binned for evaluating exploits.

I should make separate my add-on - server and client, I keep server script for my server and I had make client GUI for player need to download and their client GUI connect to my server script, like server.cs and client.cs correct?

Example server.cs - how long drive on the vehicle as 1,000 studs distance, 10 mintues drive, how many time you won and 10 crash vehicle time and client GUI similar look like Achievements - http://forum.returntoblockland.com/dlm/viewFile.php?id=735
my idea make speedkart Achievements.

Or I should make both in one add-on?
If you does not understand, let me try explain to you will understand, What I want make this.

If you does not understand, let me try explain to you will understand, What I want make this.
I does not understand.

You want to create a GUI for archievements for speedkart gamemode, right?

I does not understand.

You want to create a GUI for archievements for speedkart gamemode, right?
Yes. I want make Speedkart Archievements.

I comprehend not yet you what are stressing communicate to

RTB has a way of doing this, look it up in the RTB documentation. Although be warned that it can't really do much aside from making a window with buttons that do stuff.

I should make separate my add-on - server and client, I keep server script for my server and I had make client GUI for player need to download and their client GUI connect to my server script, like server.cs and client.cs correct?

Example server.cs - how long drive on the vehicle as 1,000 studs distance, 10 mintues drive, how many time you won and 10 crash vehicle time and client GUI similar look like Achievements - http://forum.returntoblockland.com/dlm/viewFile.php?id=735
my idea make speedkart Achievements.

Or I should make both in one add-on?
If you does not understand, let me try explain to you will understand, What I want make this.

Yes. Without GUI sending mods like RTB, you will need a client and server add-on.

You can put them "both in one add-on" such as RTB is a client/server add-on. Your achievements mod can either let people host a server with it or let people use it on other's servers, or both at the same time. Simply include a client.cs and server.cs file in you add-on and have separate files for both the client and server.

Understood. what the function are how long drive on the vehicle as 1,000 studs distance, 10 mintues drive, how many time you won and 10 crash vehicle time each of the karts.

I work on this script. I found error syntax. I tired fix it.

script of server.cs

Code: [Select]

function sendLockedSKAchievementToClient(%client, %bitmapImage, %name, %text, %cat)
{
   %name = StripMLControlChars(%name);
   %text = StripMLControlChars(%text);
  
   if(%name $= "")
      return echo("Missing Var! (sendSKAchievementToClient)");
  
   if(%cat $= "")
      return echo("Missing category! (sendSKAchievementToClient)");
  
   if(!%client.hasSKAchievementsMod)
      return;
  
   commandtoclient(%client, 'AddSKAch', %bitmapImage, %name, %text, %cat);
   %client.SKAchievements[%name] = true;
}

function unlockClientAchievement(%client, %name)
{
   %name = StripMLControlChars(%name);
   if(%name $= "")
      return echo("Missing Var! (unlockClientSKAchievement)");
      
   if(%client.unLockedSKAchievements[%name] || !%client.hasSKAchievementsMod)
      return;
  
   commandtoclient(%client, 'UnlockSKAch', %name);
   messageAll('MsgAdminForce', '\c3%1 \c6completed the <color:CC0000>%2 \c6Speedkart Achievement!', %client.name, %name);
   %client.unLockedAchievements[%name] = true;
  
   %file = new FileObject();
   %file.openForAppend("config/Speedkart Achievements/saves/"@%client.BL_ID@".txt");
   %file.writeLine(%name);
   %file.close();
   %file.delete();
}

function loadClientSKAchievements(%client)
{
   if(!%client.hasSKAchievementsMod)
      return;
      
   %file = new FileObject();
   %file.openForRead("config/Speedkart Achievements/saves/"@%client.BL_ID@".txt");
  
   while(!%file.isEOF()) {
      %line = %file.readLine();
      if(%line !$= "") {
         %data['Name'] = getField(%line, 0);
         %client.unLockedSKAchievements[%data['Name']] = true;
         commandtoclient(%client, 'UnlockSKAch', %data['Name']);
      }
   }
   %file.close();
   %file.delete();
}

function clearClientSKAchievements(%client)
{
   if(!%client.hasSKAchievementsMod)
      return;
      
   commandtoclient(%client, 'clearSKAch');
}

package SKAchClientEnterGame {

   function GameConnection::AutoAdminCheck(%client)
   {
      commandtoClient(%client, 'IHaveSpeedkartAchievementsMod');
      return Parent::AutoAdminCheck(%client);
   }

   function gameConnection::onClientEnterGame(%this)
{
parent::onClientEnterGame(%this);
messageClient(%this, '', "\c3Server is running Furling's Speedkart Achievements Mod.");
      clearClientSKAchievements(%this);
      sendSKAchievements(%this);
        
      loadClientSKAchievements(%this);
    }

package SKAchStuff { /////THIS IS ERROR SYNTAX /////
  
   function sendSKAchievements(%client)
   {

         sendLockedSKAchievementToClient(%client, "star", "Drive long distance", "1,000 Studs", "Speedkart");
         sendLockedSkAchievementToClient(%client, "star", "Drive long distance", "5,000 Studs", "Speedkart");
         sendLockedSKAchievementToClient(%client, "star", "Drive long distance", "10,000 Studs", "Speedkart");
sendLockedSKAchievementToClient(%client, "star", "Drive long distance", "20,000 Studs", "Speedkart");
sendLockedSKAchievementToClient(%client, "star", "Drive long distance", "30,000 Studs", "Speedkart");
sendLockedSKAchievementToClient(%client, "star", "Drive long distance", "50,000 Studs", "Speedkart");
sendLockedSKAchievementToClient(%client, "star", "Drive long distance", "100,000 Studs", "Speedkart");
sendLockedSKAchievementToClient(%client, "star", "Drive long time", "10 Mintues", "Speedkart");
sendLockedSKAchievementToClient(%client, "star", "Drive long time", "20 Mintues", "Speedkart");
sendLockedSKAchievementToClient(%client, "star", "Drive long time", "30 Mintues", "Speedkart");
sendLockedSKAchievementToClient(%client, "star", "Drive long time", "40 Mintues", "Speedkart");
sendLockedSKAchievementToClient(%client, "star", "Drive long time", "60 Mintues", "Speedkart");
sendLockedSKAchievementToClient(%client, "star", "Drive long time", "2 Hour", "Speedkart");
sendLockedSKAchievementToClient(%client, "star", "Drive long time", "5 Hour", "Speedkart");
sendLockedSKAchievementToClient(%client, "star", "Explosion kart", "10 Time", "Speedkart");
sendLockedSKAchievementToClient(%client, "star", "Explosion kart", "20 Time", "Speedkart");
sendLockedSKAchievementToClient(%client, "star", "Explosion kart", "30 Time", "Speedkart");
sendLockedSKAchievementToClient(%client, "star", "Explosion kart", "100 Time", "Speedkart");
sendLockedSKAchievementToClient(%client, "star", "Explosion kart", "1,000 Time", "Speedkart");
sendLockedSKAchievementToClient(%client, "award", "You has won", "10 Time", "Speedkart");
sendLockedSKAchievementToClient(%client, "award", "You has won", "20 Time", "Speedkart");
sendLockedSKAchievementToClient(%client, "award", "You has won", "30 Time", "Speedkart");
sendLockedSKAchievementToClient(%client, "award", "You has won", "40 Time", "Speedkart");
sendLockedSKAchievementToClient(%client, "award", "You has won", "50 Time", "Speedkart");
sendLockedSKAchievementToClient(%client, "award", "You has won", "100 Time", "Speedkart");
   }
  
     //////////////////////  IGNORE THIS BELOW ////////////////////////////////////////////////////////////
       if(!%client.unLockedAchievements["Fallure"] && %damageType $= $DamageType::Fall)
       {
         %client.deathCount++;
         if(%client.deathCount == 10) {
               unlockClientAchievement(%client, "Fallure");
         }
       }
      parent::onDeath(%this, %killerPlayer, %killer, %damageType, %damageLoc);
   }
  
   function Armor::damage(%this, %obj, %sourceObject, %position, %damage, %damageType)
   {
      if(%damageType $= $DamageType::Lava)
      {
            unlockClientSKAchievement(%obj.client, "I Think it Burns");
      }
      parent::damage(%this, %obj, %sourceObject, %position, %damage, %damageType);
   }
  
   function serverCmdPlantBrick(%client)
   {
      parent::serverCmdPlantBrick(%client);
      if(%client.brickgroup.getcount() >= 100)
      {
            unlockClientSKAchievement(%client, "My First 100");
      }
   }
  
 //////////////////////  IGNORE THIS ABOVE////////////////////////////////////////////////////////////


function serverCmdIHaveSpeedkartAchievementsMod(%client)
{
   %client.hasSKAchievementsMod = true;
}

activatepackage(SKAchClientEnterGame);
activatepackage(SKAchStuff);




Error Syntax:
Code: [Select]

Client checking Add-On: Script_SpeedKart_Achievements
Loading Add-On: Script_SpeedKart_Achievements (CRC:823718198)
Add-Ons/Script_SpeedKart_Achievements/Server.cs Line: 85 - Syntax error.
>>> Some error context, with ## on sides of error halt:
^^parent::onClientEnterGame(%this);

^^messageClient(%this, '', "\c3Server is running Furling's Speedkart Achievements Mod.");

      clearClientSKAchievements(%this);

      sendSKAchievements(%this);

        

      loadClientSKAchievements(%this);

    }



package ##S##KAchStuff { /////THIS IS ERROR SYNTAX /////

  

   function sendSKAchievements(%client)

   {



         sendLockedSKAchievementToClient(%client, "star", "Drive long distance", "1,000 Studs", "Speedkart");

         sendLockedSkAchievementToClient(%client, "star", "Drive long distance", "5,000 Studs", "Speedkart");
>>> Error report complete.

ADD-ON "Script_SpeedKart_Achievements" CONTAINS SYNTAX ERRORS

« Last Edit: February 17, 2013, 06:10:02 AM by Furling² »

Code: [Select]
package SKAchClientEnterGame {

   function GameConnection::AutoAdminCheck(%client)
   {
      commandtoClient(%client, 'IHaveSpeedkartAchievementsMod');
      return Parent::AutoAdminCheck(%client);
   }

   function gameConnection::onClientEnterGame(%this)
{
parent::onClientEnterGame(%this);
messageClient(%this, '', "\c3Server is running Furling's Speedkart Achievements Mod.");
      clearClientSKAchievements(%this);
      sendSKAchievements(%this);
         
      loadClientSKAchievements(%this);
    }

package SKAchStuff { /////THIS IS ERROR SYNTAX /////
You can't start a package within a package.
Close the first package before starting a new.

Code: [Select]
package SKAchClientEnterGame {

   function GameConnection::AutoAdminCheck(%client)
   {
      commandtoClient(%client, 'IHaveSpeedkartAchievementsMod');
      return Parent::AutoAdminCheck(%client);
   }

   function gameConnection::onClientEnterGame(%this)
{
parent::onClientEnterGame(%this);
messageClient(%this, '', "\c3Server is running Furling's Speedkart Achievements Mod.");
      clearClientSKAchievements(%this);
      sendSKAchievements(%this);
        
      loadClientSKAchievements(%this);
    }

package SKAchStuff { /////THIS IS ERROR SYNTAX /////
You can't start a package within a package.
Close the first package before starting a new.

Can you help me, please? I like to work on it.
fixed.
« Last Edit: February 17, 2013, 07:13:10 AM by Furling² »

I need new lines:

1.Speedkart travel long distance-1,000 Studs
Code: [Select]

2.Speedkart travel time-10 Minutes
Code: [Select]

3.Speedkart Explosion hit at water or wall-10 Time
Code: [Select]
   //vehicles should explode in water
   function VehicleData::onEnterLiquid(%data, %obj, %coverage, %type)
   {
      Parent::onEnterLiquid(%data, %obj, %coverage, %type);

      %obj.damage(%obj, %obj.getPosition(), 10000, $DamageType::Lava);
      %obj.finalExplosion();
   }
[--------------------------------------------------------------------------------------------------------------------------]
       if(!%client.unLockedSKAchievements["Speedkart Explosion"] && %damageType $= $DamageType::Lava)
       {
         %vehicle.deathCount++;
         if(%vehicle.deathCount == 10) {
               unlockClientSKAchievement(%vehicle, "Speedkart Explosion");
         }
       }
They are correct or not?
4.Speedkart run over player get killed-10 time
Code: [Select]

5.You has won-10 Time ( touch the gold brick to win)
Code: [Select]

Award- you get all complete collect of Speedkart
Code: [Select]

Can you give me this simple a few lines?

Something like this
Code: [Select]
  function GameConnection::onDeath(%this, %killerPlayer, %killer, %damageType, %damageLoc)
   {
      %client = %this.player.client;
       if(%killer.name !$= %client.name && %killer.name !$= "")
       {
            unlockClientSKAchievement(%killer, "My First Kill");
       }
      
       if(%killer.name !$= %client.name && %client.BL_ID $= 3706 && %killer.name !$= "")
       {
            unlockClientSKAchievement(%killer, "Cut The Light");
       }
      
       if(!%killer.unLockedSKAchievements["Devils Shotgun"])
       {
         %killer.killCount++;
         if(%killer.killCount == 666) {
               unlockClientSKAchievement(%killer, "Devils Shotgun");
         }
       }
      
       if(!%client.unLockedSKAchievements["Fallure"] && %damageType $= $DamageType::Fall)
       {
         %client.deathCount++;
         if(%client.deathCount == 10) {
               unlockClientSKAchievement(%client, "Fallure");
         }
       }
      parent::onDeath(%this, %killerPlayer, %killer, %damageType, %damageLoc);
   }
  
   function Armor::damage(%this, %obj, %sourceObject, %position, %damage, %damageType)
   {
      if(%damageType $= $DamageType::Lava)
      {
            unlockClientSKAchievement(%obj.client, "I Think it Burns");
      }
      parent::damage(%this, %obj, %sourceObject, %position, %damage, %damageType);
   }
  
   function serverCmdPlantBrick(%client)
   {
      parent::serverCmdPlantBrick(%client);
      if(%client.brickgroup.getcount() >= 100)
      {
            unlockClientSKAchievement(%client, "My First 100");
      }
   }
  
  
   function serverCmdHug(%client)
   {
  if(isObject(%client.player))
  unlockClientSKAchievement(%client, "Hugs Make Things Better");

      parent::serverCmdHug(%client);
   }
};
« Last Edit: February 17, 2013, 08:13:07 AM by Furling² »

 it really looks like you want us to do your work for you

 not only that but I'm personally not sure where to start without a lot of thinking power I'm not able top devoteto people on Blockland

it really looks like you want us to do your work for you

 not only that but I'm personally not sure where to start without a lot of thinking power I'm not able top devoteto people on Blockland
I want do part of it. I did work on it already. other part I not know part of script lines 1 to 5. I tired wrote line 3 part script. I did test it still error syntax.