SA-MP Forums Archive
[FilterScript] [FS]Simple 24/7 General Store Script - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] [FS]Simple 24/7 General Store Script (/showthread.php?tid=321134)



[FS]Simple 24/7 General Store Script - ryan39 - 26.02.2012

My first filterscipt!
Hello! I am relatively new to scripting in the SA-MP community and had a lot of helpful answers to help develop this script thanks to the SA-MP wiki! I am going to release my General Store script which is noob-friendly out to the community and for noobs that may need it!

OnPlayerCommandText
PHP Code:
    if(strcmp(cmdtext,"/buy",true)==0)
 if(
IsPlayerInRangeOfPoint(playerid10.0, -30.8246,-28.4104,1003.5573))
{
    
ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,"Shop List","$59 - Condoms\n$9 - Chips\n$5 - Cola\n$6 - Burger\n$680 - Safety Vest\n$125 - Camera\n$35 - Baseball Bat\n$54 - Wooden Cane\n$39 - Golf Club\n$25 - Flowers ","Purchase","Exit");
       return 
1;

OnDialogResponse
PHP Code:
if(dialogid==&& response==1)
{
switch(
listitem)
    {
        case 
0:
        {
        if(
GetPlayerMoney(playerid) <59) return SendClientMessage(playerid,0xAA3333AA"You do not have enough money!");
        new 
Float:pArmour;
        
GetPlayerArmour(playeridFloat:pArmour);
        
SendClientMessage(playerid,0xFF9900AA,"You have bought condoms for $59!");
        
GivePlayerMoney(playerid, -59);
        
SetPlayerArmour(playeridpArmour+5);
            }
        case 
1:
        {
        if(
GetPlayerMoney(playerid) <9) return SendClientMessage(playerid,0xAA3333AA"You do not have enough money!");
        
SendClientMessage(playerid0xD6D6D6AA"You purchased a bag of chips for $9");
        
GivePlayerMoney(playerid, -9);
        
ApplyAnimation(playerid,"VENDING""vend_eat1_P",4.1,0,1,1,1,1,1);
        }
        case 
2:
        {
        if(
GetPlayerMoney(playerid) <5) return SendClientMessage(playerid,0xAA3333AA"You do not have enough money!");
        new 
Float:pHealth;
        
GetPlayerHealth(playeridFloat:pHealth);
        
SendClientMessage(playerid0xD6D6D6AA"You purchased a can of cola for $5");
        
GivePlayerMoney(playerid, -5);
        
SetPlayerHealth(playeridpHealth+2);
        }
        case 
3:
        {
        if(
GetPlayerMoney(playerid) <6) return SendClientMessage(playerid,0xAA3333AA"You do not have enough money!");
        new 
Float:pArmour;
        
GetPlayerArmour(playeridFloat:pArmour);
        
SendClientMessage(playerid0xD6D6D6AA"You purchased a burger for $6");
        
SetPlayerAttachedObject(playerid428805);
        
GivePlayerMoney(playerid, -6);
        
ApplyAnimation(playerid,"VENDING""vend_eat1_P",4.1,0,1,1,1,1,1);
        
SetPlayerArmour(playeridpArmour+3);
        
SendClientMessage(playerid0xD6D6D6AA"((Use {219900}/removeobjects{D6D6D6} to remove the object!))");
        }
        case 
4:
        {
        if(
GetPlayerMoney(playerid) <680) return SendClientMessage(playerid,0xAA3333AA"You do not have enough money!");
        new 
Float:pArmour;
        
GetPlayerArmour(playeridFloat:pArmour);
        
SendClientMessage(playerid0xD6D6D6AA"You purchased a vest for $680");
        
GivePlayerMoney(playerid, -680);
        
SetPlayerArmour(playeridpArmour+35);
        }
        case 
5:
        {
        if(
GetPlayerMoney(playerid) <125) return SendClientMessage(playerid,0xAA3333AA"You do not have enough money!");
        new 
Float:pArmour;
        
GetPlayerArmour(playeridFloat:pArmour);
        
SendClientMessage(playerid0xD6D6D6AA"You purchased a {13D4A3}Camera{D6D6D6} for $125");
        
GivePlayerMoney(playerid, -125);
        
GivePlayerWeapon(playerid43100);
        }
        case 
6:
        {
        if(
GetPlayerMoney(playerid) <35) return SendClientMessage(playerid,0xAA3333AA"You do not have enough money!");
        new 
Float:pArmour;
        
GetPlayerArmour(playeridFloat:pArmour);
        
SendClientMessage(playerid0xD6D6D6AA"You purchased a {13D4A3}Baseball Bat{D6D6D6} for $35");
        
GivePlayerMoney(playerid, -35);
        
GivePlayerWeapon(playerid50);
        }
        case 
7:
        {
        if(
GetPlayerMoney(playerid) <54) return SendClientMessage(playerid,0xAA3333AA"You do not have enough money!");
        new 
Float:pArmour;
        
GetPlayerArmour(playeridFloat:pArmour);
        
SendClientMessage(playerid0xD6D6D6AA"You purchased a {13D4A3}Wooden Cane{D6D6D6} for $54");
        
GivePlayerMoney(playerid, -54);
        
GivePlayerWeapon(playerid150);
        }
        case 
8:
        {
        if(
GetPlayerMoney(playerid) <39) return SendClientMessage(playerid,0xAA3333AA"You do not have enough money!");
        new 
Float:pArmour;
        
GetPlayerArmour(playeridFloat:pArmour);
        
SendClientMessage(playerid0xD6D6D6AA"You purchased a {13D4A3}Golf Club{D6D6D6} for $39");
        
GivePlayerMoney(playerid, -39);
        
GivePlayerWeapon(playerid20);
        }
        case 
9:
        {
        if(
GetPlayerMoney(playerid) <25) return SendClientMessage(playerid,0xAA3333AA"You do not have enough money!");
        new 
Float:pArmour;
        
GetPlayerArmour(playeridFloat:pArmour);
        
SendClientMessage(playerid0xD6D6D6AA"You purchased {13D4A3}Flowers{D6D6D6} for $25");
        
GivePlayerMoney(playerid, -25);
        
GivePlayerWeapon(playerid140);
        }
    }
}
return 
1;

What does it do?


This script inserts a /buy command at the coordinates. Feel free to change the coordinates to your liking, when you do, type /buy near the new location and you will see a Dialog box. You can then purchase various items from the list. You may change the items, and if you need any help feel free to ask. This is a general script, and it is ready to use, ALL you HAVE to do is change the coordinates of the store.

Pictures




Note: If you appreciate my work, feel free to leave a +rep for my first release!



Re: [FS]Simple 24/7 General Store Script - Eiy Mard - 26.02.2012

GJ .. nice script man ! i will try it


Re: [FS]Simple 24/7 General Store Script - ryan39 - 26.02.2012

Thank you!

Let me know if you notice a bug!


Re: [FS]Simple 24/7 General Store Script - Eiy Mard - 26.02.2012

where can i find this 24/7 store ? haha xD lolz
/ls /lv /sf ??


Re: [FS]Simple 24/7 General Store Script - ryan39 - 26.02.2012

24/7 Interior 4. Then do /buy at the counter.

You can change the coordinates if you wish!


Re: [FS]Simple 24/7 General Store Script - Eiy Mard - 26.02.2012

ouh .. ok .. ty ..


Re: [FS]Simple 24/7 General Store Script - Phatomz - 26.02.2012

paste bin?


Re: [FS]Simple 24/7 General Store Script - Deathlane - 26.02.2012

Uhh... You lookin? The code is already shown...


Re: [FS]Simple 24/7 General Store Script - SampLoverNo123 - 26.02.2012

Nice


Re: [FS]Simple 24/7 General Store Script - Phatomz - 08.03.2012

Quote:
Originally Posted by ObelesMarc
View Post
Uhh... You lookin? The code is already shown...
osp

.................................................. .................................................. .................................................. ..........

how do u get the interior coordinates?

do i need to use something? ( ex: samp debug? )