Jump to content

[Tutorial] Vendendo Storage (Shop System Gesior)


athermillard

Recommended Posts

Através desse sistema você poderá vender storages em seu "shop system".

 

Noob say: Mais pra q isso?

 

Bem, com esse sistema você poderá por exemplo criar uma nova área em seu mapa e fazer com que somente entrem pessoas que tiverem essa "storage" assim sendo obtida através de uma compra do seu site "Gesior"

 

 

Vá em htdocs/shopsystem.php e logo depois procure por essa linha:

 

elseif ($data['offer_type'] == 'changename')

{

$offer['id'] = $data['id'];

$offer['type'] = $data['offer_type'];

$offer['points'] = $data['points'];

$offer['description'] = $data['offer_description'];

$offer['name'] = $data['offer_name'];

}

 

Substitua-a por essa:

 

elseif ($data['offer_type'] == 'changename')

{

$offer['id'] = $data['id'];

$offer['type'] = $data['offer_type'];

$offer['points'] = $data['points'];

$offer['description'] = $data['offer_description'];

$offer['name'] = $data['offer_name'];

}

elseif ($data['offer_type'] == 'storage')

{

$offer['id'] = $data['id'];

$offer['type'] = $data['offer_type'];

$offer['item_id'] = $data['itemid1'];

$offer['points'] = $data['points'];

$offer['description'] = $data['offer_description'];

$offer['name'] = $data['offer_name'];

}

 

Agora procure essa outra:

 

$i_changename = 0;

 

Substitua por esta:

 

$i_changename = 0;

$i_storage = 0;

 

Procure essa:

 

elseif ($data['offer_type'] == 'changename')

{

$offer_array['changename'][$i_changename]['id'] = $data['id'];

$offer_array['changename'][$i_changename]['points'] = $data['points'];

$offer_array['changename'][$i_changename]['description'] = $data['offer_description'];

$offer_array['changename'][$i_changename]['name'] = $data['offer_name'];

$i_changename++;

}

 

Substitua:

 

elseif ($data['offer_type'] == 'changename')

{

$offer_array['changename'][$i_changename]['id'] = $data['id'];

$offer_array['changename'][$i_changename]['points'] = $data['points'];

$offer_array['changename'][$i_changename]['description'] = $data['offer_description'];

$offer_array['changename'][$i_changename]['name'] = $data['offer_name'];

$i_changename++;

}

elseif ($data['offer_type'] == 'storage')

{

$offer_array['storage'][$i_storage]['id'] = $data['id'];

$offer_array['storage'][$i_storage]['points'] = $data['points'];

$offer_array['storage'][$i_storage]['item_id'] = $data['itemid1'];

$offer_array['storage'][$i_storage]['description'] = $data['offer_description'];

$offer_array['storage'][$i_storage]['name'] = $data['offer_name'];

$i_storage++;

}

 

Procure:

 

0 or count($offer_list['unban']) > 0

 

Substitua:

 

0 or count($offer_list['unban']) > 0 or count($offer_list['storage']) > 0

 

Procure:

 

$main_content .= '<form action="index.php?subtopic=shopsystem&action=select_player" method=POST><input type="hidden" name="buy_id" value="'.$changename['id'].'"><input type="submit" value="Buy '.$changename['name'].'"><br><b>for '.$changename['points'].' points</b></form>';

}

 

Substitua:

 

$main_content .= '<form action="index.php?subtopic=shopsystem&action=select_player" method=POST><input type="hidden" name="buy_id" value="'.$changename['id'].'"><input type="submit" value="Buy '.$changename['name'].'"><br><b>for '.$changename['points'].' points</b></form>';

}

//Storage by: Ather

if(count($offer_list['storage']) > 0)

foreach($offer_list['storage'] as $storage) {

$main_content .= '<tr bgcolor="gray"><td align="center">Storage</td><td><b>'.$storage['name'].'</b> ('.$storage['points'].' points)<br />'.$storage['description'].'</td><td align="center">';

if(!$logged) $main_content .= '<b>Entre Primeiro</b>'; else

$main_content .= '<form action="index.php?subtopic=shopsystem&action=select_player" method=POST><input type="hidden" name="buy_id" value="'.$storage['id'].'"><input type="submit" value="Buy '.$storage['name'].'"><br><b>for '.$storage['points'].' points</b></form>';

}

 

Procure:

 

$main_content .= '<center><b>You don\'t have any bans in your account!</b><br><br><a href="index.php?subtopic=shopsystem">Go back</a><br>';

}

}

 

Substitua:

 

$main_content .= '<center><b>You don\'t have any bans in your account!</b><br><br><a href="index.php?subtopic=shopsystem">Go back</a><br>';

}

}

 

//Storage by: Ather

elseif($buy_offer['type'] == 'storage') {

$my_acc_id = $buy_player->getCustomField('id');

$datadata = $SQL->query('SELECT * FROM '.$SQL->tableName('player_storage').' WHERE player_id = '.$my_acc_id.';')->fetch();

if($datadata['player_id'] == $my_acc_id) {

if($SQL->query('UPDATE player_storage SET value=1 WHERE `key` = '.$SQL->quote($buy_offer['item_id']).' AND player_id='.$my_acc_id.';')) {

} else {

$SQL->query('UPDATE player_storage SET value=1 WHERE `key` = '.$SQL->quote($buy_offer['item_id']).' AND player_id='.$my_acc_id.';');

}

$account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);

$user_premium_points = $user_premium_points - $buy_offer['points'];

$main_content .= '<center><h2>Storage enviada!</h2><b>Você recebeu sua storage por '.$buy_offer['points'].' pontos</b> da sua account.

<br>Agora você possui <b>'.$user_premium_points.' pontos</b>.<br><br><a href="index.php?subtopic=shopsystem">Voltar para o Shop</a><br>';

} else {

$main_content .= '<center><b>Erro</b><br><br><a href="index.php?subtopic=shopsystem">Go back</a><br>';

}

}

 

 

Pronto agora vamos ao painel de adiministração:

 

em htdocs/shopadmin procure:

 

<td><font color="white">Changename</td>

 

Substitua:

 

<td><font color="white">Changename</td><td><font color="white">Storage</td>

 

Procure:

 

<td align="center"><input type="radio" name="offer_type" value="changename" onClick="this.form.submit()"></td>

 

Substitua:

 

<td align="center"><input type="radio" name="offer_type" value="changename" onClick="this.form.submit()"></td>

<td align="center"><input type="radio" name="offer_type" value="storage" onClick="this.form.submit()"></td>

 

Procure:

 

<td><input type="text" name="shop_count1" maxlenght="7" style="width: 70px" ></td></tr>';

}

 

Substitua:

 

<td><input type="text" name="shop_count1" maxlenght="7" style="width: 70px" ></td></tr>';

}

//Storage by: Ather

if($_REQUEST['offer_type'] == 'storage'){

$main_content .= '<tr><td align="center"><b>Storage:</b></td>

<td><input type="text" name="shop_itemid1" maxlenght="7" style="width: 70px" ></td></tr>';

}

//Fim

 

Procure:

 

<tr><td align="center" ><b>Count Item:</b></td>

<td>'.$shop_count1.'</td></tr><br>';

}

 

Substitua:

 

<tr><td align="center" ><b>Count Item:</b></td>

<td>'.$shop_count1.'</td></tr><br>';

}

if ($shop_offer_type == 'storage'){

$main_content .= '<tr><td align="center" ><b>Storage:</b></td>

<td>'.$shop_itemid1.'</td></tr><br>';

}

 

Procure:

 

<td><input type="text" name="shop_count1" maxlenght="7" value="'.$shop['count1'].'" style="width: 70px" ></td></tr>';

}

 

Substitua:

 

<td><input type="text" name="shop_count1" maxlenght="7" value="'.$shop['count1'].'" style="width: 70px" ></td></tr>';

}

// Storage by: Ather

if($shop['offer_type'] == 'storage'){

$main_content .= '<tr><td align="center"><b>Storage:</b></td>

<td><input type="text" name="shop_itemid1" maxlenght="7" value="'.$shop['itemid1'].'" style="width: 70px" ></td></tr>';

}

//fim

 

 

Ufa acabou :)

 

Espero que funcione ^^ com vocês também!

 

Tá com duvidas? Pergunte :)

Link to comment
Share on other sites

  • 3 weeks later...
  • 2 months later...
  • 1 month later...
  • 1 month later...

Uh, amigo, agora quando eu faço uma venda em Adicionar offert, eu recebo tudo, faz até mesmo me adicionado, mas quando vou para a loja, Esta página fica em branco sem qualquer oferta, eu segui todos os passos como você explicar isso para você em sua mensagem, você pode me ajudar?

Edited by lopez65
Link to comment
Share on other sites

  • 3 years later...
×
×
  • Create New...