Help me in [Else]
#6

Quote:
Originally Posted by CutX
Посмотреть сообщение
you're simply missing the curly brackets which open/close your compound statements.
just like in most programming languages,
a simple if - else control structure looks as follows:
pawn Код:
if(/*CONDITION*/)
{
    //do stuff
}
else
{
    //do other stuff
}
you want something like...
pawn Код:
CMD:robbery( playerid, params[ ] )
{
    if(/*some condition defined by you*/)
    {
        if ( pRobbingP[ playerid ] )
                return SendClientMessage( playerid, RED, "ERROR:{FFFFFF} You are already robbing Idlewood Pizza" );

        if ( !IsPlayerInRangeOfPoint( playerid, 3.0, -23.4826,-55.6319,1003.5469 ) )
            return SendClientMessage( playerid, RED, "ERROR:{FFFFFF} You must be in the checkpoint at Idlewood Pizza to use this command!" );

        if ( SevenRobbed )
            return SendClientMessage( playerid, RED, "ERROR:{FFFFFF} Idlewood Pizza has been robbed recently, please wait patiently!" );

        robTimerP[ playerid ] = SetTimerEx( "robPizza", 30000, false, "i", playerid );

        SendClientMessage( playerid, INFO, "[ROBBERY INFO] You have started a robbery, it will last 30 seconds. Do not leave the checkpoint!" );

        pRobbingP[ playerid ] = true;
        SevenRobbed = true;

        new
            szStr[ 128 ],
            usrName[ 24 ];

        GetPlayerName( playerid, usrName, 24 );
        format( szStr, 128, "[ROBBERY] %s has began a robbery at Idlewood Pizza!", usrName );
        SendClientMessageToAll( ROB, szStr );

        GameTextForPlayer( playerid, "~g~Robbery in process~n~~r~Do not leave the checkpoint!", 30000, 3 );
        SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid) +2);
    }
    else
    {
        if ( pRobbingP[ playerid ] )
                return SendClientMessage( playerid, RED, "ERROR:{FFFFFF} You are already robbing Idlewood Pizza" );

        if ( !IsPlayerInRangeOfPoint( playerid, 3.0, -23.4826,-55.6319,1003.5469 ) )
            return SendClientMessage( playerid, RED, "ERROR:{FFFFFF} You must be in the checkpoint at Idlewood Pizza to use this command!" );

        if ( SexShopRobbed )
            return SendClientMessage( playerid, RED, "ERROR:{FFFFFF} Idlewood Pizza has been robbed recently, please wait patiently!" );

        robTimerP[ playerid ] = SetTimerEx( "robPizza", 30000, false, "i", playerid );

        SendClientMessage( playerid, INFO, "[ROBBERY INFO] You have started a robbery, it will last 30 seconds. Do not leave the checkpoint!" );

        pRobbingP[ playerid ] = true;
        SevenRobbed = true;

        new
            szStr[ 128 ],
            usrName[ 24 ];

        GetPlayerName( playerid, usrName, 24 );
        format( szStr, 128, "[ROBBERY] %s has began a robbery at Idlewood Pizza!", usrName );
        SendClientMessageToAll( ROB, szStr );

        GameTextForPlayer( playerid, "~g~Robbery in process~n~~r~Do not leave the checkpoint!", 30000, 3 );
        SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid) +2);
    }
    return 1;
}
right? kinda weird though, as both is the same... you need to tell us what you wanna do
still error
this my full code
PHP код:
#include <a_samp>
#include <Streamer>
#include <zcmd>
#define RED -1
#define ROB -1
#define INFO -1
forward robSevenplayerid ); //Add this to the top of your script under your includes!
forward robSexShopplayerid ); //Add this to the top of your script under your includes!
//IDLEWOOD PIZZA
new
        
robTimerPMAX_PLAYERS ],
        
cp_Seven,
        
cp_SexShop,
        
boolpRobbingPMAX_PLAYERS ],
        
boolSevenRobbed;
public 
OnGameModeInit()
{
    
cp_SexShop CreateDynamicCP(-104.1407,-22.6708,1000.71883.0, .interiorid = -1);
    
cp_Seven CreateDynamicCP(-23.4826,-55.6319,1003.54693.0, .interiorid = -1);
    return 
1;
}
public 
OnPlayerEnterDynamicCPplayeridcheckpointid )
{
    if( 
pRobbingPplayerid ] )
    {
            if ( 
checkpointid == cp_Seven )
            {
                
pRobbingPplayerid ] = false;
                
KillTimerrobTimerPplayerid ] );
                
SevenRobbed false;
                
GameTextForPlayerplayerid"~r~You have failed the robbery!"1000);
            }
    }
    if( 
pRobbingPplayerid ] )
    {
            if ( 
checkpointid == cp_SexShop )
            {
                
pRobbingPplayerid ] = false;
                
KillTimerrobTimerPplayerid ] );
                
SevenRobbed false;
                
GameTextForPlayerplayerid"~r~You have failed the robbery!"1000);
            }
    }
    return 
true;
}
CMD:robberyplayeridparams[ ] )
{
        if ( 
pRobbingPplayerid ] )
                return 
SendClientMessageplayeridRED"ERROR:{FFFFFF} You are already robbing Idlewood Pizza" );
        if ( !
IsPlayerInRangeOfPointplayerid3.0, -23.4826,-55.6319,1003.5469 ) )
            return 
SendClientMessageplayeridRED"ERROR:{FFFFFF} You must be in the checkpoint at Idlewood Pizza to use this command!" );
        if ( 
SevenRobbed )
            return 
SendClientMessageplayeridRED"ERROR:{FFFFFF} Idlewood Pizza has been robbed recently, please wait patiently!" );
        
robTimerPplayerid ] = SetTimerEx"robPizza"30000false"i"playerid );
        
SendClientMessageplayeridINFO"[ROBBERY INFO] You have started a robbery, it will last 30 seconds. Do not leave the checkpoint!" );
        
pRobbingPplayerid ] = true;
        
SevenRobbed true;
        new
            
szStr128 ],
            
usrName24 ];
        
GetPlayerNameplayeridusrName24 );
        
formatszStr128"[ROBBERY] %s has began a robbery at Idlewood Pizza!"usrName );
        
SendClientMessageToAllROBszStr );
        
GameTextForPlayerplayerid"~g~Robbery in process~n~~r~Do not leave the checkpoint!"30000);
        
SetPlayerWantedLevel(playeridGetPlayerWantedLevel(playerid) +2);
        }
        else
        {
        if ( 
pRobbingPplayerid ] )
                return 
SendClientMessageplayeridRED"ERROR:{FFFFFF} You are already robbing Idlewood Pizza" );
        if ( !
IsPlayerInRangeOfPointplayerid3.0, -23.4826,-55.6319,1003.5469 ) )
            return 
SendClientMessageplayeridRED"ERROR:{FFFFFF} You must be in the checkpoint at Idlewood Pizza to use this command!" );
        if ( 
SexShopRobbed )
            return 
SendClientMessageplayeridRED"ERROR:{FFFFFF} Idlewood Pizza has been robbed recently, please wait patiently!" );
        
robTimerPplayerid ] = SetTimerEx"robPizza"30000false"i"playerid );
        
SendClientMessageplayeridINFO"[ROBBERY INFO] You have started a robbery, it will last 30 seconds. Do not leave the checkpoint!" );
        
pRobbingPplayerid ] = true;
        
SevenRobbed true;
        new
            
szStr128 ],
            
usrName24 ];
        
GetPlayerNameplayeridusrName24 );
        
formatszStr128"[ROBBERY] %s has began a robbery at Idlewood Pizza!"usrName );
        
SendClientMessageToAllROBszStr );
        
GameTextForPlayerplayerid"~g~Robbery in process~n~~r~Do not leave the checkpoint!"30000);
        
SetPlayerWantedLevel(playeridGetPlayerWantedLevel(playerid) +2);
        }
        return 
true;
}
public 
robSevenplayerid )
{
        new
            
randMoney random96000 );
        
GivePlayerMoneyplayeridrandMoney );
        new
            
szStr128 ],
            
szStr1[128],
            
usrName24 ];
        
GetPlayerNameplayeridusrName24 );
        
formatszStr128"[ROBBERY] %s has robbed $%d from Idlewood Pizza!"usrNamerandMoney );
        
SendClientMessageToAllROBszStr );
        
formatszStr128"[ROBBERY INFO] Robbery succesfull! You have earned $%d and 1 score from the robbery."randMoney );
        
SendClientMessageplayeridINFOszStr );
        
pRobbingPplayerid ] = false;
        
SetTimer"pizzaDelay"90000false );
        
format(szStr1sizeof (szStr1), "~g~You have succesfuly robbed $%d from Idlewood Pizza!"randMoney);
        
GameTextForPlayerplayeridszStr13000);
        
SetPlayerScore(playeridGetPlayerScore(playerid) +);
        
}
public 
robSexShopplayerid )
{
        new
            
randMoney random96000 );
        
GivePlayerMoneyplayeridrandMoney );
        new
            
szStr128 ],
            
szStr1[128],
            
usrName24 ];
        
GetPlayerNameplayeridusrName24 );
        
formatszStr128"[ROBBERY] %s has robbed $%d from Idlewood Pizza!"usrNamerandMoney );
        
SendClientMessageToAllROBszStr );
        
formatszStr128"[ROBBERY INFO] Robbery succesfull! You have earned $%d and 1 score from the robbery."randMoney );
        
SendClientMessageplayeridINFOszStr );
        
pRobbingPplayerid ] = false;
        
SetTimer"pizzaDelay"90000false );
        
format(szStr1sizeof (szStr1), "~g~You have succesfuly robbed $%d from Idlewood Pizza!"randMoney);
        
GameTextForPlayerplayeridszStr13000);
        
SetPlayerScore(playeridGetPlayerScore(playerid) +);
}
forward SexShopDelay( );
public 
SexShopDelay( )
{
    
SevenRobbed false;
    return 
true;
}
forward SevenDelay( );
public 
SevenDelay( )
{
    
SevenRobbed false;
    return 
true;

im new i get tut. there 1 robing only i add the new SexShop to robing it too
and i adding in cmd:robbery
the sexshop
and i have much error
Reply


Messages In This Thread
Help me in [Else] - by sas10 - 02.01.2015, 20:44
Re: Help me in [Else] - by sas10 - 02.01.2015, 21:00
Re: Help me in [Else] - by UploaD - 02.01.2015, 21:08
Re: Help me in [Else] - by sas10 - 02.01.2015, 21:10
AW: Re: Help me in [Else] - by CutX - 02.01.2015, 21:11
Re: AW: Re: Help me in [Else] - by sas10 - 02.01.2015, 21:17
Re: Help me in [Else] - by sas10 - 02.01.2015, 21:20
AW: Re: Help me in [Else] - by CutX - 02.01.2015, 21:25
Re: Help me in [Else] - by UploaD - 02.01.2015, 21:25
Re: Help me in [Else] - by sas10 - 02.01.2015, 21:29

Forum Jump:


Users browsing this thread: 1 Guest(s)