Unknow Command when command typed.
#1

PHP код:
#define FILTERSCRIPT
#include <a_samp>
#include <streamer>
#include <sscanf2>
#include <YSI\y_ini>
#define DIALOG_ATMMENU  1
#define DIALOG_BALANCE  2
#define DIALOG_WITHDRAW 3
#define DIALOG_DEPOSIT  4
#define PATH "/BankAccounts/%s.ini"
enum pInfo
{
    
pBankAccount,
    
pAccountdata
}
new 
PlayerInfo[MAX_PLAYERS][pInfo];
public 
OnGameModeInit()
{
    
// Don't use these lines if it's a filterscript
    
SetGameModeText("Blank Script");
    
AddPlayerClass(01958.37831343.157215.3746269.1425000000);
    
    
CreateObject(2942,-2760.10009766,-358.79998779,6.80000019,0.00000000,0.00000000,180.00000000); //object(kmb_atm1) (1)
    
CreateObject(2942,-2761.00000000,-358.79998779,6.80000019,0.00000000,0.00000000,180.00000000); //object(kmb_atm1) (2)
    
return 1;
}
forward LoadUser_data(playerid,name[],value[]);
stock GetName(playerid)
{
    new 
Name[MAX_PLAYER_NAME];
    if(
IsPlayerConnected(playerid))
    {
        
GetPlayerName(playeridNamesizeof(Name));
    }
    return 
Name;
}
public 
LoadUser_data(playerid,name[],value[])
{
    
INI_Int("BankAccount",PlayerInfo[playerid][pBankAccount]);
    
INI_Int("Datasaved",PlayerInfo[playerid][pAccountdata]);
    return 
1;
}
stock UserPath(playerid)
{
    new 
string[128],playername[MAX_PLAYER_NAME];
    
GetPlayerName(playerid,playername,sizeof(playername));
    
format(string,sizeof(string),PATH,playername);
    return 
string;
}
public 
OnPlayerDisconnect(playeridreason)
{
    new 
INI:File INI_Open(UserPath(playerid));
    
INI_SetTag(File,"data");
    
INI_WriteInt(File,"BankAccount",PlayerInfo[playerid][pBankAccount]);
    
INI_WriteInt(File,"Datasaved",PlayerInfo[playerid][pAccountdata]);
    
INI_Close(File);
    return 
1;
}
public 
OnPlayerConnect(playerid)
{
    if(
PlayerInfo[playerid][pAccountdata] == 0)
    {
        new 
INI:File INI_Open(UserPath(playerid));
        
INI_SetTag(File,"data");
        
INI_WriteInt(File,"BankAccount",0);
        
INI_WriteInt(File,"DataSaved",1);
        
INI_Close(File);
        
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra true, .extra playerid);
    }
    else
    {
        
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra true, .extra playerid);
    }
    return 
1;
}
public 
OnPlayerCommandText(playeridcmdtext[])
{
    if (
strcmp("/atm"cmdtexttrue10) == 0)
    {
        if(
IsPlayerInRangeOfPoint(playerid,5.0,-2760.10009766,-358.79998779,6.80000019))
        {
            new 
string[256];
            
format(stringsizeof(string), "%s's Bank Account"GetName(playerid));
            
ShowPlayerDialog(playerid,DIALOG_ATMMENU,DIALOG_STYLE_LISTstring,"Check balance \nWithdraw\ndeposit""Select""Close");
            return 
1;
        }
        else
        
SendClientMessage(playerid,-1,"ERROR: You are not near a atm!");
        return 
1;
    }
    return 
0;
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    new 
balance[256];
    switch( 
dialogid )
    {
        case 
DIALOG_ATMMENU:
        {
            if(!
response)
            {
                
SendClientMessage(playerid0xFFFFFF"SERVER: Selection cancelled.");
            }
            else
            {
                switch(
listitem)
                {
                    case 
0:
                    {
                        
format(balancesizeof(balance), """You currently have $%d In your bank account."PlayerInfo[playerid][pBankAccount]);
                        
ShowPlayerDialog(playerid,DIALOG_BALANCE,DIALOG_STYLE_MSGBOX"Bank Account Balance"balance"Back""");
                    }
                    case 
1:
                    {
                        
ShowPlayerDialog(playerid,DIALOG_WITHDRAW,DIALOG_STYLE_INPUT"Bank Account Withdraw""How much would you like to withdraw your bank account?""Withdraw""");
                    }
                }
            }
            return 
1;
        }
        case 
DIALOG_BALANCE:
        {
            new 
string[256];
            
format(stringsizeof(string), "%s's Bank Account"GetName(playerid));
            if(
response)
            {
                
ShowPlayerDialog(playerid,DIALOG_ATMMENU,DIALOG_STYLE_LISTstring,"Check balance \nWithdraw""Select""Close");
            }
        }
        case 
DIALOG_WITHDRAW:
        {
            new 
string[256];
            if(
response)
            {
                new 
type strval(inputtext);
                if(
type == 0)
                {
                    
ShowPlayerDialog(playerid,DIALOG_WITHDRAW,DIALOG_STYLE_INPUT"Bank Account Withdraw""How much would you like to withdraw your bank account?""Withdraw""");
                }
                if(
PlayerInfo[playerid][pBankAccount] >= type)
                {
                       
PlayerInfo[playerid][pBankAccount] -= type;
                      
GivePlayerMoney(playeridtype);
                      
format(stringsizeof(string), "INFO: You have successfully withdrawn $%d from your bank account."type);
                      
SendClientMessage(playerid0xFFFFFFstring);
                  }
                  else 
SendClientMessage(playerid0xFFFFFF"SERVER: You do not have that much amount in your account");
            }
        }
          case 
DIALOG_DEPOSIT:
        {
            new 
string[256];
            if(
response)
            {
                new 
type strval(inputtext);
                if(
type == 0)
                {
                    
ShowPlayerDialog(playerid,DIALOG_DEPOSIT,DIALOG_STYLE_INPUT"Bank Account Deposit""How much would you like to deposit into your bank account?""deposit""");
                }
                if(
GetPlayerMoney(playerid)< type)
                {
                       
GivePlayerMoney(playerid,-type);
                       
PlayerInfo[playerid][pBankAccount] += type;
                      
format(stringsizeof(string), "INFO: You have successfully deposited $%d to your bank account."type);
                      
SendClientMessage(playerid0xFFFFFFstring);
                  }
                  else 
SendClientMessage(playerid0xFFFFFF"SERVER: You do not have that much amount in your hand");
            }
        }
    }
    return 
1;

Okay I tried to make this script but when I type /atm, it says unknown command,it does not work,please help me by fixing this.
ThAnKs.
Reply
#2

Bump...Please help.
Reply
#3

Are you using this as a filterscript for your gamemode?
Reply
#4

I want to add this as a filterscript.
Reply
#5

bump...Please help.
Reply
#6

Just don't bumb too much, be patient and wait for any response..

Also, try #define filterscript
Reply
#7

Not working.
Reply
#8

strange, it's working fine for me O_o do you have included your filterscript in config.cfg?
Reply
#9

Yes I did but?Do I have to add the plugins in the config file?.
Reply
#10

yes, if you are using some plugin like mysql, sscanf or w/e you have to add this line to config

Код:
plugins XXX YYY ZZZ
(plugin name)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)