Jump to content
MakeWebGames

Diffrent bonus for diffrent race/clan?


zefiux

Recommended Posts

How Can I make diffrent bonus for diffrent race/clan?

I know how to force game to check it..

 

{if $player->race == 'Fire Clan'}
/* Script which executes +xx Something in mySQL
*/
{else}
{if $player->race == 'Ice Clan'}
/* Script which executes +xx Some other stuff in mySQL
*/
{else}
{if $player->race == 'Noob Clan'}
/* Script which executes +xx Some other stuff(again!) in mySQL
*/
{else}
{/if}
{/if}
{/if}

 

Would be awesome If I could get help.. I'm noob(worse than newbie) at programming...

Link to comment
Share on other sites

I tryed this code, but of course it doesn't work.... Now if any1 has hints(Hints would be more awesome than you fixing code, so I could learn something ,_,) :(

 

<?php
defined('IN_EZRPG') or exit;

$hooks->add_hook('player', 'level_up', 2);

function hook_level_up($db, &$tpl, $player, $args = 0)
{
   //No player data
   if ($args === 0 || LOGGED_IN == false)
      return $args;

   //Check if player has leveled up






{if $player->village == 'Enerugi Village'}

{
   //No player data
   if ($args === 0 || LOGGED_IN == false)
      return $args;

   //Check if player has leveled up
if ($args->exp >= $args->max_exp)
   {
       //Update the current player variable ($args)
       $args->exp = $args->exp - $args->max_exp;
       $args->level += 1;
       $args->stat_points += 5;
       $args->max_exp += 100;
       $args->max_energy += 10;
       $args->energy += 10;
       $args->hp += 20;
       $args->max_hp += 20;

       //Update the database
       $db->execute('UPDATE `<ezrpg>players` SET `exp`=?, `level`=level+1, `stat_points`=stat_points+5, `max_exp`=max_exp+100, `energy`=energy+10, `max_energy`=max_energy+10, `hp`=hp+20, `max_hp`=max_hp+20 WHERE `id`=?', array(intval($args->exp), intval($args->id)));

       //Add event log
       $msg = 'You have leveled up! You gained +5 stat points, +10 max energy and +20 max hp!';
       addLog(intval($args->id), $msg, $db);
   }

   return $args;
}


{else}
{if $player->village == 'Kenko Village'}


{
   //No player data
   if ($args === 0 || LOGGED_IN == false)
      return $args;

   //Check if player has leveled up
if ($args->exp >= $args->max_exp)
   {
       //Update the current player variable ($args)
       $args->exp = $args->exp - $args->max_exp;
       $args->level += 1;
       $args->stat_points += 5;
       $args->max_exp += 100;
       $args->max_energy += 5;
       $args->energy += 5;
       $args->hp += 40;
       $args->max_hp += 40;

       //Update the database
       $db->execute('UPDATE `<ezrpg>players` SET `exp`=?, `level`=level+1, `stat_points`=stat_points+5, `max_exp`=max_exp+100, `energy`=energy+5, `max_energy`=max_energy+5, `hp`=hp+40, `max_hp`=max_hp+40 WHERE `id`=?', array(intval($args->exp), intval($args->id)));

       //Add event log
       $msg = 'You have leveled up! You gained +5 stat points, +5 max energy and +40 max hp!';
       addLog(intval($args->id), $msg, $db);
   }

   return $args;
}


{else}
{if $player->village == 'Jinsokuna Village'}


{
   //No player data
   if ($args === 0 || LOGGED_IN == false)
      return $args;

   //Check if player has leveled up
if ($args->exp >= $args->max_exp)
   {
       //Update the current player variable ($args)
       $args->exp = $args->exp - $args->max_exp;
       $args->level += 1;
       $args->stat_points += 10;
       $args->max_exp += 100;
       $args->max_energy += 5;
       $args->energy += 5;
       $args->hp += 20;
       $args->max_hp += 20;

       //Update the database
       $db->execute('UPDATE `<ezrpg>players` SET `exp`=?, `level`=level+1, `stat_points`=stat_points+10, `max_exp`=max_exp+100, `energy`=energy+5, `max_energy`=max_energy+5, `hp`=hp+20, `max_hp`=max_hp+20 WHERE `id`=?', array(intval($args->exp), intval($args->id)));

       //Add event log
       $msg = 'You have leveled up! You gained +10 stat points, +5 max energy and +20 max hp!';
       addLog(intval($args->id), $msg, $db);
   }

   return $args;
}

{else}


{
   //No player data
   if ($args === 0 || LOGGED_IN == false)
      return $args;

   //Check if player has leveled up
if ($args->exp >= $args->max_exp)
   {
       //Update the current player variable ($args)
       $args->exp = $args->exp - $args->max_exp;
       $args->level += 1;
       $args->stat_points += 5;
       $args->max_exp += 100;
       $args->max_energy += 5;
       $args->energy += 5;
       $args->hp += 20;
       $args->max_hp += 20;

       //Update the database
       $db->execute('UPDATE `<ezrpg>players` SET `exp`=?, `level`=level+1, `stat_points`=stat_points+5, `max_exp`=max_exp+100, `energy`=energy+5, `max_energy`=max_energy+5, `hp`=hp+20, `max_hp`=max_hp+20 WHERE `id`=?', array(intval($args->exp), intval($args->id)));

       //Add event log
       $msg = 'You have leveled up! You gained +5 stat points, +5 max energy and +20 max hp!';
       addLog(intval($args->id), $msg, $db);
   }

   return $args;
}

{/if}
{/if}
{/if}


}
?>

 

I've 1% feeling that it is inposibble... and 99% that I did mistake, due to my Noobish skills ,_,

Edited by zefiux
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...