Help with command
#1

PHP код:
if(sscanf(cmdtext"s[30]S()[30]S()[12]"szCmdInfoszActionInfo,szSubActionInfo,szDepositInfo))
    {
        
SendClientMessage(playerid, -1"USAGE: /fsafe [Action]");
        
SendClientMessage(playerid, -1"Available Actions: check, deposit, withdraw");
        return 
1;
    }
    if(!
strcmp(szCmdInfo"deposit"true)){
        
// Deposit here:
        
if(sscanf(szActionInfo"s[30]"szDepositInfo)) {
            
SendClientMessage(playerid, -1"Available Actions: {FFFFFF}money, weapon");
            return 
SendClientMessage(playerid, -1"/fsafe deposit [Action]");
        }
        if(!
strcmp(szActionInfo"money"true)){
            if(
sscanf(szDepositInfo"i"amount)) return SendClientMessage(playerid, -1"/fsafe deposit money [amount]");
            if(
amount<=0) return SendClientMessage(playeridCOLOR_RED"Error:{FFFFFF} Amount cannot be less than $1.");
            
GiveMoney(playerid,-amount);
            
FamilyInfo[id][family_money] +=amount;
            
format(msizeof(m), "You have successfully deposited $%i in your family safe. Current family safe cash $%i."amount,FamilyInfo[id][family_money]);
            
SendClientMessage(playeridCOLOR_GREYm);
        }
        if(!
strcmp(szActionInfo"weapon"true)){
            if(
GetPlayerWeapon(playerid)==30||GetPlayerWeapon(playerid)==24||GetPlayerWeapon(playerid)==34||GetPlayerWeapon(playerid)==31){
                switch(
GetPlayerWeapon(playerid)){
                    case 
30:{
                        
RemovePlayerWeapon(playerid,30);
                        
FamilyInfo[id][family_ak]++;
                        
SendClientMessage(playeridCOLOR_GREEN"Success:{FFFFFF} You've successfully deposited your AK-47.");
                        return 
1;
                    }
                }
            }else{
                return 
SendClientMessage(playeridCOLOR_RED"Error:{FFFFFF} You can't store this weapon.");
            }
        }
    } 
/fsafe deposit money [Amount]

when ever i do this command, it just send me this
PHP код:
if(sscanf(szDepositInfo"i"amount)) return SendClientMessage(playerid, -1"/fsafe deposit money [amount]"); 
Reply
#2

You have to add another specifier for 'szDepositInfo'.
You currently have this at the beginning of your snippet:
Код:
if(sscanf(cmdtext, "s[30]S()[30]S()[12]", szCmdInfo, szActionInfo,szSubActionInfo,szDepositInfo))
It has to be this:
Код:
if(sscanf(cmdtext, "s[30]S()[30]S()[12]S()[16]", szCmdInfo, szActionInfo,szSubActionInfo,szDepositInfo))
Reply
#3

Quote:
Originally Posted by bgedition
Посмотреть сообщение
You have to add another specifier for 'szDepositInfo'.
You currently have this at the beginning of your snippet:
Код:
if(sscanf(cmdtext, "s[30]S()[30]S()[12]", szCmdInfo, szActionInfo,szSubActionInfo,szDepositInfo))
It has to be this:
Код:
if(sscanf(cmdtext, "s[30]S()[30]S()[12]S()[16]", szCmdInfo, szActionInfo,szSubActionInfo,szDepositInfo))
Not worked
Reply
#4

You don't need to use sscanf for that time.
PHP код:
if(amount<=0) return SendClientMessage(playeridCOLOR_RED"Error:{FFFFFF} Amount cannot be less than $1."); 
it is enough.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)