SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Includes

Reply
 
Thread Tools Display Modes
Old 16/11/2017, 04:40 PM   #1
CaioTJF
Gangsta
 
CaioTJF's Avatar
 
Join Date: Sep 2012
Location: Rio de Janeiro
Posts: 521
Reputation: 127
Default MenuStore (Build dynamic stores with TextDraws)

MenuStore.inc

This include allows you to create many types of stores using Textdraws.

Demonstration



Click on the image to see the video.

Functions

PHP Code:
stock MenuStore_AddItem(playeriditemidmodelidname[], pricedescription[] = EOSFloat:description_size 0.0bool:description_line_jump truestack 1Float:rotX 0.0Float:rotY 0.0Float:rotZ 0.0Float:zoom 1.0
  • "itemid" - Item ID, will serve as "key", each item must have unique ID.
  • "modelid" - Model of the item that will be displayed in the preview.
  • "name" - Item name.
  • "price" - Item price.
  • "description" - Item description.
  • "Float:description_size" - Increase description box, value default is 0.0.
  • "bool:description_line_jump" - Automatic line break or not
  • "stack" - Above 1, the item can be stacked in the cart.
  • "rotX", "rotY", "rotZ" - Preview Rotation.
  • "Float:zoom " - Preview Zoom.

PHP Code:
stock MenuStore_Open(playeridmenuid[], store_name[], money_sign[] = MS_DEFAULT_MONEY_SIGNbutton_confirm[] = MS_DEFAULT_CONFIRM
  • "menuid" - It works just like easyDialog, you can by any name without having to define it.
  • "store_name" - Store name.
  • "money_sign" - Money sign, the default is "$"
  • "button_confirm" - Name of the confirm button, the default value is "Buy".


Code Example

PHP Code:

if(strcmp(cmd"/store"true) == 0)
{
    
MenuStore_AddItem(playerid1342"Granade"500"Throw to explode."200);
    
MenuStore_AddItem(playerid2344"Molotov"500"Throw to set fire to something."200);
    
MenuStore_AddItem(playerid3346"9mm Pistol"500"Pistol with low firepower.");
    
MenuStore_AddItem(playerid4347"Silenced 9mm"500"Pistol with low firepower.");
    
MenuStore_AddItem(playerid5348"Desert Eagle"500"Pistol with high firepower.");
    
MenuStore_AddItem(playerid6349"Shotgun"500"Normal Shotgun.");
    
MenuStore_AddItem(playerid7350"Sawnoff Shotgun"500"Powerfull Shotgun.");
    
MenuStore_AddItem(playerid8351"Combat Shotgun"500"Powerfull Shotgun.");
    
MenuStore_AddItem(playerid9352"Micro SMG"500"Two-handed machine gun.");
    
MenuStore_AddItem(playerid10353"MP5"500"Machine gun.");
    
MenuStore_AddItem(playerid11355"AK-47"500"Powerfull Rifle.");
    
MenuStore_AddItem(playerid12356"M4"500"Powerfull Rifle.");
    
MenuStore_AddItem(playerid13372"Tec-9"500"Powerfull machine gun.");
    
MenuStore_AddItem(playerid14357"Country Rifle"500"Normal Rifle.");
    
MenuStore_AddItem(playerid15358"Sniper Rifle"500"Powerfull Rifle.");
    
MenuStore_Show(playeridWeapon_Shop"Shop Weapons");
    return 
1;
}

Store:Weapon_Shop(playeridresponseitemidmodelidpriceamountitemname[])
{
    if(!
response)
        return 
true;

    if(
GetPlayerMoney(playerid) < price)
        return 
SendClientMessage(playerid, -1"You don't have enough money.");

    if(
amount == 1) {
        
GivePlayerWeapon(playeridGetWeaponIDFromModel(modelid), 200);
    }
    else {
        
GivePlayerWeapon(playeridGetWeaponIDFromModel(modelid), amount);
    }
    
    new 
string[128];
    
format(string128"You bought %dx %s"amountitemname);
    
SendClientMessage(playerid, -1string);
    
    
GivePlayerMoney(playerid, -price);
    return 
true;
}

stock GetWeaponIDFromModel(modelid)
{
    new 
idweapon;
    switch(
modelid)
    {
        case 
331idweapon 1// Brass Knuckles
        
case 333idweapon 2// Golf Club
        
case 334idweapon 3// Nightstick
        
case 335idweapon 4// Knife
        
case 336idweapon 5// Baseball Bat
        
case 337idweapon 6// Shovel
        
case 338idweapon 7// Pool Cue
        
case 339idweapon 8// Katana
           
case 341idweapon 9// Chainsaw
           
case 321idweapon 10// Double-ended Dildo
           
case 325idweapon 14// Flowers
           
case 326idweapon 15// Cane
           
case 342idweapon 16// Grenade
           
case 343idweapon 17// Tear Gas
        
case 344idweapon 18// Molotov Cocktail
        
case 346idweapon 22// 9mm
        
case 347idweapon 23// Silenced 9mm
        
case 348idweapon 24// Desert Eagle
        
case 349idweapon 25// Shotgun
        
case 350idweapon 26// Sawnoff
        
case 351idweapon 27// Combat Shotgun
        
case 352idweapon 28// Micro SMG/Uzi
        
case 353idweapon 29// MP5
        
case 355idweapon 30// AK-47
        
case 356idweapon 31// M4
        
case 372idweapon 32// Tec-9
        
case 357idweapon 33// Country Rifle
        
case 358idweapon 34// Sniper Rifle
        
case 359idweapon 35// RPG
        
case 360idweapon 36// HS Rocket
        
case 361idweapon 37// Flamethrower
        
case 362idweapon 38// Minigun
        
case 363idweapon 39;// Satchel Charge + Detonator
        
case 365idweapon 41// Spraycan
        
case 366idweapon 42// Fire Extinguisher
        
case 367idweapon 43// Camera
    
}
    return 
idweapon;

Download

Github

Sorry for my English, it's not my native language.
__________________

IP: 192.99.94.236:7771 / Website: www.gtatorcidas.net

Procurando VPS para hospedar seu servidor? --> www.blasthosting.com.br

Last edited by CaioTJF; 21/11/2017 at 06:40 PM.
CaioTJF is offline   Reply With Quote
Old 16/11/2017, 04:44 PM   #2
Eoussama
High-roller
 
Eoussama's Avatar
 
Join Date: Jul 2016
Location: Kingdom of Morocco // Tangier
Posts: 1,117
Reputation: 153
Default Re: MenuStore (Build dynamic stores with TextDraws)

+Rep for the neat design!
__________________
Eoussama is offline   Reply With Quote
Old 16/11/2017, 04:50 PM   #3
Pottus
Godfather
 
Pottus's Avatar
 
Join Date: Jun 2012
Posts: 5,314
Reputation: 1171
Default Re: MenuStore (Build dynamic stores with TextDraws)

You should always use global textdraws where possible there is a lot of player textdraws wasted here plus extra overhead to create them needlessly.
Pottus is offline   Reply With Quote
Old 16/11/2017, 05:04 PM   #4
CaioTJF
Gangsta
 
CaioTJF's Avatar
 
Join Date: Sep 2012
Location: Rio de Janeiro
Posts: 521
Reputation: 127
Default Re: MenuStore (Build dynamic stores with TextDraws)

Quote:
Originally Posted by Pottus View Post
You should always use global textdraws where possible there is a lot of player textdraws wasted here plus extra overhead to create them needlessly.
The include uses 53 Player Textdraws, and they are destroyed when MenuStore_Close () is called.

That is, with the menu open there are still 203 spaces of textdraws.

This will only give you trouble if you create 203 textdraws at the same time WITH the menu open. But maybe I do an update by changing that.
__________________

IP: 192.99.94.236:7771 / Website: www.gtatorcidas.net

Procurando VPS para hospedar seu servidor? --> www.blasthosting.com.br
CaioTJF is offline   Reply With Quote
Old 16/11/2017, 05:11 PM   #5
ExTaZZ69
Big Clucker
 
ExTaZZ69's Avatar
 
Join Date: Mar 2015
Location: Romania
Posts: 142
Reputation: 17
Default Re: MenuStore (Build dynamic stores with TextDraws)

Just convert the static ones to global (that black and gray backgrounds, arrows, etc).
ExTaZZ69 is offline   Reply With Quote
Old 16/11/2017, 05:26 PM   #6
CaioTJF
Gangsta
 
CaioTJF's Avatar
 
Join Date: Sep 2012
Location: Rio de Janeiro
Posts: 521
Reputation: 127
Default Re: MenuStore (Build dynamic stores with TextDraws)

Quote:
Originally Posted by ExTaZZ69 View Post
Just convert the static ones to global (that black and gray backgrounds, arrows, etc).
Next update I'll do it
__________________

IP: 192.99.94.236:7771 / Website: www.gtatorcidas.net

Procurando VPS para hospedar seu servidor? --> www.blasthosting.com.br
CaioTJF is offline   Reply With Quote
Old 16/11/2017, 06:29 PM   #7
HydraHumza
Gangsta
 
HydraHumza's Avatar
 
Join Date: Oct 2014
Posts: 639
Reputation: 110
Default Re: MenuStore (Build dynamic stores with TextDraws)

Looks promising. Keep up the good work. REP+
__________________
Owner of Call of Duty 4 Modern Warfare.

HydraHumza is offline   Reply With Quote
Old 17/11/2017, 06:18 PM   #8
CaioTJF
Gangsta
 
CaioTJF's Avatar
 
Join Date: Sep 2012
Location: Rio de Janeiro
Posts: 521
Reputation: 127
Default Re: MenuStore (Build dynamic stores with TextDraws)

Version 3.0

- Some PlayerTDs have been transformed into GlobalTDs
- Fixed bugs
__________________

IP: 192.99.94.236:7771 / Website: www.gtatorcidas.net

Procurando VPS para hospedar seu servidor? --> www.blasthosting.com.br
CaioTJF is offline   Reply With Quote
Old 17/11/2017, 07:18 PM   #9
PT
Godfather
 
PT's Avatar
 
Join Date: Nov 2012
Location: Portugal
Posts: 7,091
Reputation: 736
Default Re: MenuStore (Build dynamic stores with TextDraws)

I think Pottus will be happy now.

Nice work by the way
__________________
"Quem caiu e se levantou honrado era e honrado ficou..."


http://steamcommunity.com/id/pt_player/
PT is offline   Reply With Quote
Old 17/11/2017, 10:39 PM   #10
Freaksken
Gangsta
 
Freaksken's Avatar
 
Join Date: Mar 2009
Location: Belgium
Posts: 532
Reputation: 209
Default Re: MenuStore (Build dynamic stores with TextDraws)

Good job!
__________________
Always keep in mind that a lot of people are active on this forum in their spare time.
They are sacrificing time they could easily spend on things they would rather do, to help you instead.


[Include] FCNPC A.I. - [Tutorial] Speedometer - [WIP] Single-player-like Mission - [Other] List of all my work
Freaksken is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Include] MenuStore (Crie lojas utilizando TextDraws) CaioTJF Lançamentos/Releases 48 22/11/2017 03:23 PM
Dynamic Textdraws. MartiQ Scripting Help 0 27/01/2014 08:43 PM
Dynamic textdraws Face9000 Scripting Help 4 17/01/2014 02:00 PM
[FilterScript] [0.3e]Niko_boy"s Vehicle Spawner Based on TextDraws [Build 1.1] Niko_boy Filterscripts 22 21/11/2012 03:47 PM
[Include] e_steam - Dynamic Streamer + Fast (2x) - Build 1 BlueFire_ Includes 16 17/10/2012 02:50 PM


All times are GMT. The time now is 06:32 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.