24/7 script
#1

Hello, im wondering if some of you guys that know to script good can hel me out with a 24/7 script, I want that when you go in to the 24/7 interior and type /store it will show you a menu with Items you can buy, all I need for now is lets say Beer and Ciga for start.

-Thank you
Reply
#2

PHP код:
#include <a_samp>
#define SHOP_MENU 0

new init;

public 
OnPlayerCommandText(playeridcmdtext[])
{
    if (
strcmp("/store"cmdtexttrue10) == 0)
    {
        
init GetPlayerInterior(playerid);
        if(
IsPlayerInRangeOfPoint(playerid,4.0,x,y,z) && init == [24/7 interior id])
        {
            
ShowPlayerDialog(playerid,SHOP_MENU,DIALOG_STYLE_LIST,"Store","Beer $50\nCiga $20","Buy","Cancel");//here you add item and price using \n[item]_[price]
            
return 1;
        }
        else
        {
             
SendClientMessage(playerid,0xFF0000FF,"You aren't in 24/7 store!");
         }
        return 
1;
    }
    return 
0;
}


public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid == SHOP_MENU)
    {
        if(!
response)
        {
            
SendClientMessage(playerid,0xFF0000FF,"You have canceled store menu");
        }
        if(
response)
        {
            switch(
listitem)
            {
                case 
0:
                {
                    if(
GetPlayerMoney(playerid) < 50)
                    {
                        
SendClientMessage(playerid,0xFF0000FF,"You don't have enough money!");
                        return 
1;
                    }
                    else
                    {
                        
GivePlayerMoney(playerid, -50);//Change price for Beer if you want
                        
SendClientMessage(playerid,0x00FF00FF,"You have bought beer for $50.");
                        
your variable that player now has beer
                    
}
                }
                case 
1:
                {
                    if(
GetPlayerMoney(playerid) < 20);
                    {
                        
SendClientMessage(playerid,0xFF0000FF,"You don't have enough money!");
                        return 
1;
                    }
                    else
                    {
                        
GivePlayerMoney(playerid, -20);// Also change price of cigar here
                        
SendClientMessage(playerid,0x00FF00FF,"You have bought ciga for $20.");
                        
// Here insert your variable that player has
                    
}
                }
            }
        }
    }
    return 
1;

Here it is. Just replace what I said in script comment lines
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)