Esempio n. 1
0
 public static function Init()
 {
     /* Initialize the skills */
     Players::RegisterSkill(SKILL_COOKING, 5, 'cooking', 'Cooking');
     Players::RegisterSkill(SKILL_LUCK, 10, 'luck', 'Luck');
     Players::RegisterSkill(SKILL_ALCOHOLIC, 5, 'alcoholic', 'Alcoholic');
     $skill = Players::RegisterSkill(SKILL_DRUGSADDICT, 4, 'drugsaddict', 'Drugs addict');
     $skill->SetReqLevel(2, 4);
     $skill->SetReqLevel(3, 7);
     $skill->SetReqLevel(4, 11);
     $skill = Players::RegisterSkill(SKILL_PROFKILLER, 6, 'profkiller', 'Professional killer');
     $skill->SetReqLevel(2, 6);
     $skill->SetReqLevel(3, 8);
     $skill->SetReqLevel(4, 11);
     $skill->SetReqLevel(5, 15);
     $skill->SetReqLevel(6, 20);
     $skill = Players::RegisterSkill(SKILL_GUNSDEALER, 6, 'gunsdealer', 'Guns dealer');
     $skill->SetReqLevel(2, 3);
     $skill->SetReqLevel(3, 5);
     $skill->SetReqLevel(4, 8);
     $skill->SetReqLevel(5, 12);
     $skill->SetReqLevel(6, 17);
     $skill = Players::RegisterSkill(SKILL_DRUGSDEALER, 4, 'drugsdealer', 'Drugs dealer');
     $skill->SetReqLevel(2, 3);
     $skill->SetReqLevel(3, 6);
     $skill->SetReqLevel(4, 10);
     Players::RegisterSkill(SKILL_NEGSKILLS, 5, 'negskills', 'Negotiation skills', SKILL_LUCK, 5);
     Players::RegisterSkill(SKILL_FARMING, 0, 'farming', 'Farming');
     Players::RegisterSkill(SKILL_FISHING, 0, 'fishing', 'Fishing');
     /* Create the upgrade menu */
     $menu = new Menu(null, 'Upgrades', array('Players', 'menuUpgradesEnter'), array('Players', 'menuUpgradesExit'), 1, new Position(50, 120), 150);
     foreach (Players::$skills as $skill) {
         if ($skill->flag < SKILL_MAXUPGRADE) {
             $menu->Add($skill->name, 0, ROW_ACTION, array('Players', 'menuUpgradesSelect'));
         }
     }
     Players::$upgrade_menu = $menu;
     /* Create the upgrade textdraws list */
     Players::$upgrade_draws = array_fill(0, MAX_PLAYERS, null);
     /* Register timers, callbacks and commands */
     AddTimer(array('Players', 'Update'), 500, 1);
     AddTimer(array('Players', 'Stream'), 800, 1);
     Callbacks::Instance()->Register(cOnPlayerConnect, null, array('Players', 'OnPlayerConnect'), 0);
     Callbacks::Instance()->Register(cOnPlayerDisconnect, null, array('Players', 'OnPlayerDisconnect'), 5);
     Callbacks::Instance()->Register(cOnPlayerDeath, null, array('Players', 'OnPlayerDeath'));
     Callbacks::Instance()->Register(cOnPlayerSpawn, null, array('Players', 'OnPlayerSpawn'));
     Callbacks::Instance()->Register(cOnPlayerRequestClass, null, array('Players', 'OnPlayerRequestClass'), -1000);
     Callbacks::Instance()->Register(cOnPlayerRequestSpawn, null, array('Players', 'OnPlayerRequestSpawn'));
     Callbacks::Instance()->Register(cOnPlayerEnterVehicle, null, array('Players', 'OnPlayerEnterVehicle'), -1000);
     Callbacks::Instance()->Register(cOnPlayerKeyStateChange, null, array('Players', 'OnPlayerKeyStatechange'));
     CommandHandler::Register('togjq', 0, null, array('Players', 'cmdTogjq'), '', 1, -1000);
     CommandHandler::Register('togooc', 0, null, array('Players', 'cmdTogooc'), '', 1, -1000);
     CommandHandler::Register('die', 0, null, array('Players', 'cmdDie'), '', 1, -1000);
     CommandHandler::Register('stats', 0, null, array('Players', 'cmdStats'), '', 1, -1000);
     CommandHandler::Register('pay', 2, null, array('Players', 'cmdPay'), '[ID] [amount]', 1, -1000);
     CommandHandler::Register('skills', 0, null, array('Players', 'cmdSkills'), '', 1, -1000);
     CommandHandler::Register('upgrade', 0, null, array('Players', 'cmdUpgrade'), '', 1, -1000);
     CommandHandler::Register('speedometer', 1, null, array('Players', 'cmdSpeedometer'), '[kmh/mph]', 1, -1000);
     CommandHandler::Register('autowalk', 0, null, array('Players', 'cmdAutoWalk'), '', 1, -1000);
     Players::$players_by_id = array_fill(0, MAX_PLAYERS, null);
     /* Create the incar textdraws */
     for ($i = 0; $i < MAX_PLAYERS; $i++) {
         Players::$incar_draws[$i] = TextDrawCreate(549.0, 393.0, '.');
         TextDrawUseBox(Players::$incar_draws[$i], 1);
         TextDrawBoxColor(Players::$incar_draws[$i], 0x66);
         TextDrawTextSize(Players::$incar_draws[$i], 627.0, -10.0);
         TextDrawAlignment(Players::$incar_draws[$i], 0);
         TextDrawBackgroundColor(Players::$incar_draws[$i], 0xff);
         TextDrawFont(Players::$incar_draws[$i], 1);
         TextDrawLetterSize(Players::$incar_draws[$i], 0.499999, 1.1);
         TextDrawColor(Players::$incar_draws[$i], 0xffffffff);
         TextDrawSetOutline(Players::$incar_draws[$i], 1);
         TextDrawSetProportional(Players::$incar_draws[$i], 1);
         TextDrawSetShadow(Players::$incar_draws[$i], 1);
         TextDrawHideForAll(Players::$incar_draws[$i]);
     }
 }