zefiux Posted February 10, 2012 Share Posted February 10, 2012 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... Quote Link to comment Share on other sites More sharing options...
Spudinski Posted February 10, 2012 Share Posted February 10, 2012 Click me, or die. Quote Link to comment Share on other sites More sharing options...
zefiux Posted February 11, 2012 Author Share Posted February 11, 2012 (edited) 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 February 11, 2012 by zefiux Quote Link to comment Share on other sites More sharing options...
lucky3809 Posted February 11, 2012 Share Posted February 11, 2012 lol your script gives me a headache, so many lines uncalled for do as spudinski said click the link or die... lol Quote Link to comment Share on other sites More sharing options...
Spudinski Posted February 11, 2012 Share Posted February 11, 2012 Template syntax != PHP. It's Pseudocode. Ref: http://en.wikipedia.org/wiki/Pseudocode Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.