24/7 script
#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


Messages In This Thread
24/7 script - by Compton - 15.07.2011, 11:03
Re: 24/7 script - by [MG]Dimi - 15.07.2011, 13:18

Forum Jump:


Users browsing this thread: 1 Guest(s)