Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class public_samp_game_create extends ipsCommand
- {
- public function doExecute( ipsRegistry $registry )
- {
- if(!$this->memberData['member_id'])
- {
- $this->registry->output->showError('Aby móc przeglądać tą zakładkę, musisz się zalogować.',0);
- }
- if(isset($this->request['create_char']))
- {
- if($this->request['charsex'] != 1 && $this->request['charsex'] != 0)
- {
- $this->registry->output->showError('Płeć postaci nie została wybrana lub jest błędna.', 0);
- }
- $create_name = $this->DB->addSlashes($this->request['charname']);
- $this->DB->query("SELECT char_name FROM hia_players WHERE char_name LIKE '".$this->DB->addSlashes($this->request['charname'])."'");
- if($this->DB->getTotalRows() > 0)
- {
- $existing = $this->DB->fetch();
- $this->registry->output->showError('Postać podobna do tej, jest własnością innego gracza.', 0);
- }
- if(!empty($this->request['charname']) && !preg_match('~[A-Z][a-z]*~',$this->request['charname']))
- {
- $this->registry->output->showError('Podana przez Ciebie nazwa postaci jest błędna.', 0);
- }
- $create_age = trim(2013 - intval($this->request['charage']));
- $create_sex = trim(intval($this->request['charsex']));
- $create_gid = trim(intval($this->memberData['member_id']));
- $create_skin = trim(intval($this->request['skin']));
- $this->DB->insert( "players", array( 'char_name' => $create_name, 'char_sex' => $create_sex, 'char_age' => $create_age, 'char_gid' => $create_gid, 'char_skin' => $create_skin ) );
- $create_name = str_replace("_", " ", $create_name);
- $this->registry->output->redirectScreen( 'Utworzyłeś postać '.$create_name.'.', $this->settings['base_url'] . 'app=samp' );
- }
- $this->DB->query('SELECT * FROM `hia_players` WHERE `char_gid` = '.$this->memberData['member_id'].' AND `char_online` < 18000 LIMIT 1');
- $this->DB->execute();
- $char = $this->DB->fetch();
- if(!$char['char_uid'] || $this->memberData['member_group_id'] == 4)
- {
- $this->DB->query('SELECT * FROM `hia_skins_samp`');
- $this->DB->execute();
- while($skin = $this->DB->fetch())
- {
- $skins[] = $skin;
- }
- $template = $this->registry->output->getTemplate('game')->game_create($skins);
- $this->registry->getClass('output')->addContent($template);
- $this->registry->output->setTitle('Kreator postaci');
- $this->registry->output->addNavigation( 'Kreator postaci', 'app=samp&module=game§ion=create' );
- $this->registry->getClass('output')->sendOutput();
- }
- else
- {
- $this->registry->output->showError('Nie możesz założyć kolejnej postaci.',0);
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement