Moderators Parkho Posted September 3, 2012 Moderators Report Share Posted September 3, 2012 First off add a column into your phpvms_pilots in your DB as "bonus" the type must be "float" and set default az "0". Then open the following: Admin/modules/PIREPadmin/PIREPAdmin.php go down to line 298 and find the function called : approve_pirep_post(). Now go to the end of it and add the following: After this: # Call the event CodonEvent::Dispatch('pirep_accepted', 'PIREPAdmin', $pirep_details); Add this: # Give Bonus to good pilots $pilotbonus = "500"; $userinfo = PilotData::getPilotData($pirep_details->pilotid); if($pirep_details->landingrate > -50 OR $pirep_details->flighttime > 8) { $totalpay = $pilotbonus + $userinfo->totalpay ; $bonus = $pilotbonus +$userinfo->bonus; $fields = array ( 'totalpay' => $totalpay, 'bonus' => $bonus, ); PilotData::updateProfile($userinfo->pilotid, $fields); } then go to your profile_main.tpl and after this: <li><strong>Total Money: </strong><?php echo FinanceData::FormatMoney($userinfo->totalpay) ?></li> Add this: <li><strong>Total Bonus: </strong><?php echo FinanceData::FormatMoney($userinfo->bonus) ?></li> Now when you recieve pireps and hit the accept button, your pilots get bonus on low landing rate or long haul. Off course you can adjust the variables to your desire as follows: $pilot bonus = "500" // This is set to 500 and can be changed. landing rate is set to -50 ft/m. flight time is set to 8 hours. Enjoy. 3 Quote Link to comment Share on other sites More sharing options...
ATAvCEO Posted September 9, 2012 Report Share Posted September 9, 2012 Hi Parkho, Awesome idea, but I added everything as specified above and my VP of Ops did a flight he had a landing rate of 240+ and it still credited him the $250 bonus. I kept all the settings the same as what you have listed above with the < 50 and 8. His flight was only 1.2 hours long. I set the bonus to 250 Any ideas? Quote Link to comment Share on other sites More sharing options...
mseiwald Posted September 9, 2012 Report Share Posted September 9, 2012 I have something similar to this on my site.... I'm pretty sure the calculation must be changed from < 50 to > -50 for it to work Quote Link to comment Share on other sites More sharing options...
mseiwald Posted September 9, 2012 Report Share Posted September 9, 2012 Please delete this post. Duplicated the above one by mistake Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted September 9, 2012 Author Moderators Report Share Posted September 9, 2012 Hi Parkho, Awesome idea, but I added everything as specified above and my VP of Ops did a flight he had a landing rate of 240+ and it still credited him the $250 bonus. I kept all the settings the same as what you have listed above with the < 50 and 8. His flight was only 1.2 hours long. I set the bonus to 250 Any ideas? I have tested it and it works fine, maybe mseiwald is right and you're gonna have to change the <50 to >-50. Quote Link to comment Share on other sites More sharing options...
ATAvCEO Posted September 9, 2012 Report Share Posted September 9, 2012 Ok, thanks will give it a try and see what happens. Thanks for the info Quote Link to comment Share on other sites More sharing options...
Txmmy83 Posted September 18, 2012 Report Share Posted September 18, 2012 I have tested it and it works fine, maybe mseiwald is right and you're gonna have to change the <50 to >-50. will give it a try Quote Link to comment Share on other sites More sharing options...
ATAvCEO Posted September 19, 2012 Report Share Posted September 19, 2012 Thanks guys for the help mseiwald's idea worked perfectly. Quote Link to comment Share on other sites More sharing options...
CedGauche Posted June 5, 2015 Report Share Posted June 5, 2015 Thanks for this code! We also use it, but we have a problem. In our Fleet is a helicopter with the aircraft id 5, this 'aircraft' is not allowed to gain bonus. We use this code: $pilotbonus = "50";$userinfo = PilotData::getPilotData($pirep_details->pilotid); if($pirep_details->landingrate > -80 AND $pirep_details->aircraft != 5) { $totalpay = $pilotbonus + $userinfo->totalpay ; $bonus = $pilotbonus +$userinfo->bonus; $fields = array ( 'totalpay' => $totalpay, 'bonus' => $bonus, ); PilotData::updateProfile($userinfo->pilotid, $fields); But still the helicopter pilots earn bonus, what is wrong? Quote Link to comment Share on other sites More sharing options...
Members Vangelis Posted June 6, 2015 Members Report Share Posted June 6, 2015 The logical operator for not is just ! Try if($pirep_details->landingrate > -80 AND $pirep_details->aircraft ! 5) Quote Link to comment Share on other sites More sharing options...
CedGauche Posted June 6, 2015 Report Share Posted June 6, 2015 OK thx, I will try it Quote Link to comment Share on other sites More sharing options...
CedGauche Posted October 10, 2015 Report Share Posted October 10, 2015 Is it possible to give bonus to a pilot, if the pireplog contains a string like "IVAO"? I had coded something, but every pilot get the IVAO bonus money after accepting the Pirep, also the offline pilots. This was my code: $pilotbonus = "50"; $userinfo = PilotData::getPilotData($pirep_details->pilotid); if($pirep_details->log!=str_replace("IVAO","",$string)) { $totalpay = $pilotbonus + $userinfo->totalpay ; $bonus = $pilotbonus +$userinfo->bonus; $fields = array ( 'totalpay' => $totalpay, 'bonus' => $bonus, ); PilotData::updateProfile($userinfo->pilotid, $fields); } Quote Link to comment Share on other sites More sharing options...
Members Vangelis Posted October 11, 2015 Members Report Share Posted October 11, 2015 Try this $pilotbonus = "50"; $userinfo = PilotData::getPilotData($pirep_details->pilotid); $FindIvao = strpos($pirep_details->log,IVAO) if($FindIvao === true) { $totalpay = $pilotbonus + $userinfo->totalpay ; $bonus = $pilotbonus +$userinfo->bonus; $fields = array ( 'totalpay' => $totalpay, 'bonus' => $bonus, ); PilotData::updateProfile($userinfo->pilotid, $fields); } Quote Link to comment Share on other sites More sharing options...
CedGauche Posted October 11, 2015 Report Share Posted October 11, 2015 Hi, thx for the help, but it dosen't work, no pilot get's a bonus. Also I have added ";" after $FindIvao = strpos($pirep_details->log,IVAO), cause without I get an error. Perhaps "$pirep_details->log" is the wrong variable? Quote Link to comment Share on other sites More sharing options...
Members Vangelis Posted October 11, 2015 Members Report Share Posted October 11, 2015 Yes sorry i forgot to add it In with class do you add this ? Quote Link to comment Share on other sites More sharing options...
CedGauche Posted October 11, 2015 Report Share Posted October 11, 2015 I just added it after the pilotbonus option. But I think it's the right variable. So I don't know whats the problem. Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted October 12, 2015 Author Moderators Report Share Posted October 12, 2015 Hi, is 'IVAO' part of your flight log? Meaning do you see that word in your flight log when you open it? Quote Link to comment Share on other sites More sharing options...
CedGauche Posted October 12, 2015 Report Share Posted October 12, 2015 Hi, yes for sure, this is a part of the log: [17:46] - IVAO Online Flight and this is the class for the pirep_details, i am sure the logfile is in there: public static function getReportDetails($pirepid){ $sql = 'SELECT p.*, s.*, s.id AS scheduleid, p.route, p.route_details, u.pilotid, u.firstname, u.lastname, u.email, u.rank, dep.name as depname, dep.lat AS deplat, dep.lng AS deplng, arr.name as arrname, arr.lat AS arrlat, arr.lng AS arrlng, p.code, p.flightnum, p.depicao, p.arricao, p.price AS price, a.id as aircraftid, a.name as aircraft, a.registration, p.flighttime, p.distance, UNIX_TIMESTAMP(p.submitdate) as submitdate, p.accepted, p.log FROM '.TABLE_PREFIX.'pilots u, '.TABLE_PREFIX.'pireps p LEFT JOIN '.TABLE_PREFIX.'airports AS dep ON dep.icao = p.depicao LEFT JOIN '.TABLE_PREFIX.'airports AS arr ON arr.icao = p.arricao LEFT JOIN '.TABLE_PREFIX.'aircraft a ON a.id = p.aircraft LEFT JOIN '.TABLE_PREFIX.'schedules s ON s.code = p.code AND s.flightnum = p.flightnum WHERE p.pilotid=u.pilotid AND p.pirepid='.$pirepid; $row = DB::get_row($sql); $row->rawdata = unserialize($row->rawdata); Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted October 12, 2015 Author Moderators Report Share Posted October 12, 2015 Try this: public static function get_ivao_log($id) { $sql = "SELECT * FROM phpvms_pireps WHERE pirepid = '$id'"; $result = DB::get_row($sql); $log = explode('*', $result->log); foreach($log as $line) { if (strpos($line, "IVAO") !== false) { $temp = $line; break; } } $temp = explode(' ', $temp); $title = $temp[1]; return $title; } And to call it: YourCommonFile::get_ivao_log($pirep->pirepid); You could assign this to a variable like: $ivao = YourCommonFile::get_ivao_log($pirep->pirepid); And say it like : if($ivao == "IVAO") { $pilotbonus = "500"; $userinfo = PilotData::getPilotData($pirep_details->pilotid); if($pirep_details->landingrate > -50 OR $pirep_details->flighttime > 8) { $totalpay = $pilotbonus + $userinfo->totalpay ; $bonus = $pilotbonus +$userinfo->bonus; $fields = array ( 'totalpay' => $totalpay, 'bonus' => $bonus, ); PilotData::updateProfile($userinfo->pilotid, $fields); } } Quote Link to comment Share on other sites More sharing options...
Iraklis Posted October 12, 2015 Report Share Posted October 12, 2015 can i ask a question?? because our VA is an Aproved Airline in the IVAO network, this bonus is when a pilot create a PIREP in IVAO gets the bonus??? Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted October 12, 2015 Author Moderators Report Share Posted October 12, 2015 Yeah! supposedly. Quote Link to comment Share on other sites More sharing options...
CedGauche Posted October 12, 2015 Report Share Posted October 12, 2015 Yes, we have a custom acars and before every flight a pilot has to klick yes or no, if his flight was on IVAO. I had coded a script that check this in the admin menu, if his flight was online (IVAO Tracker). thx for your help parkho. Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted October 13, 2015 Author Moderators Report Share Posted October 13, 2015 did it work? Quote Link to comment Share on other sites More sharing options...
CedGauche Posted October 13, 2015 Report Share Posted October 13, 2015 no, it doesn't work, perhaps it's my fault, I hadn't enought time to check it out. Quote Link to comment Share on other sites More sharing options...
ercio Posted November 4, 2015 Report Share Posted November 4, 2015 is that possible to use that and change to penalize pilots also with landing rates over -450 , like -600 rejecting the flight and returning s pilot accident minor ,mid an severe? or accepting the flight and returning as pilot accident minor , mid , severe? Quote Link to comment Share on other sites More sharing options...
Melli Posted December 20, 2016 Report Share Posted December 20, 2016 (edited) oooh no :-( first time i think its working but now i see i have the same problem as ATAvCEO. the tip from meiswald ( changed from < 50 to > -50 for it to work ) doesn not work. i teste all kind of "<50 <-50 >50 and <-50" nothing. my pilotes gets everytime after a flight the bonus. maybe its not working with FSacars and Xacars?? here my code: # Give Bonus to good pilots $pilotbonus = "10"; $userinfo = PilotData::getPilotData($pirep_details->pilotid); if($pirep_details->landingrate > -50 OR $pirep_details->flighttime > 3) $totalpay = $pilotbonus + $userinfo->totalpay ; $bonus = $pilotbonus +$userinfo->bonus; $fields = array ( 'totalpay' => $totalpay, 'bonus' => $bonus, ); PilotData::updateProfile($userinfo->pilotid, $fields); } Edited December 20, 2016 by Melli Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted December 21, 2016 Author Moderators Report Share Posted December 21, 2016 10 hours ago, Melli said: oooh no :-( first time i think its working but now i see i have the same problem as ATAvCEO. the tip from meiswald ( changed from < 50 to > -50 for it to work ) doesn not work. i teste all kind of "<50 <-50 >50 and <-50" nothing. my pilotes gets everytime after a flight the bonus. maybe its not working with FSacars and Xacars?? here my code: # Give Bonus to good pilots $pilotbonus = "10"; $userinfo = PilotData::getPilotData($pirep_details->pilotid); if($pirep_details->landingrate > -50 OR $pirep_details->flighttime > 3) $totalpay = $pilotbonus + $userinfo->totalpay ; $bonus = $pilotbonus +$userinfo->bonus; $fields = array ( 'totalpay' => $totalpay, 'bonus' => $bonus, ); PilotData::updateProfile($userinfo->pilotid, $fields); } I know for sure XACARS doesn't provide landing rate data and this code is working base on that. However, I'm not sure about FSACARS. Quote Link to comment Share on other sites More sharing options...
Melli Posted December 21, 2016 Report Share Posted December 21, 2016 thx parkho, same code i tested...not working in my VA. you right, xacars dont log landingrates, i only testet, because im getting on each pirep a bonus.in my case, it doesnt matter is a landingrate inside the log or not... every pirep a count a bonus, also from FSacars. :-( Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted December 21, 2016 Author Moderators Report Share Posted December 21, 2016 45 minutes ago, Melli said: thx parkho, same code i tested...not working in my VA. you right, xacars dont log landingrates, i only testet, because im getting on each pirep a bonus.in my case, it doesnt matter is a landingrate inside the log or not... every pirep a count a bonus, also from FSacars. :-( Look into your PIREPS table for landing rate column and make sure its records are negative numbers. If they are positive numbers then the code doesn't work. Quote Link to comment Share on other sites More sharing options...
Melli Posted December 23, 2016 Report Share Posted December 23, 2016 lol...at this moment nothing counts anymore. i give up. htx parkho 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.