CMD:robbery( playerid, params[ ] )
{
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);
return true;
}
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);
D:\tryrobs.pwn(81) : error 029: invalid expression, assumed zero D:\tryrobs.pwn(81 -- 83) : warning 215: expression has no effect D:\tryrobs.pwn(83) : error 001: expected token: ";", but found "if" D:\tryrobs.pwn(89) : error 017: undefined symbol "SexShopRobbed" D:\tryrobs.pwn(100) : error 021: symbol already defined: "szStr" |
CMD:robbery( playerid, params[ ] )
{
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 true;
}
}
else
{
#include <a_samp>
#include <Streamer>
#include <zcmd>
#define RED -1
#define ROB -1
#define INFO -1
forward robSeven( playerid ); //Add this to the top of your script under your includes!
forward robSexShop( playerid ); //Add this to the top of your script under your includes!
//IDLEWOOD PIZZA
new
robTimerP[ MAX_PLAYERS ],
cp_Seven,
cp_SexShop,
bool: pRobbingP[ MAX_PLAYERS ],
bool: SevenRobbed;
public OnGameModeInit()
{
cp_SexShop = CreateDynamicCP(-104.1407,-22.6708,1000.7188, 3.0, .interiorid = -1);
cp_Seven = CreateDynamicCP(-23.4826,-55.6319,1003.5469, 3.0, .interiorid = -1);
return 1;
}
public OnPlayerEnterDynamicCP( playerid, checkpointid )
{
if( pRobbingP[ playerid ] )
{
if ( checkpointid == cp_Seven )
{
pRobbingP[ playerid ] = false;
KillTimer( robTimerP[ playerid ] );
SevenRobbed = false;
GameTextForPlayer( playerid, "~r~You have failed the robbery!", 1000, 3 );
}
}
if( pRobbingP[ playerid ] )
{
if ( checkpointid == cp_SexShop )
{
pRobbingP[ playerid ] = false;
KillTimer( robTimerP[ playerid ] );
SevenRobbed = false;
GameTextForPlayer( playerid, "~r~You have failed the robbery!", 1000, 3 );
}
}
return true;
}
CMD:robbery( playerid, params[ ] )
{
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 true;
}
public robSeven( playerid )
{
new
randMoney = random( 96000 );
GivePlayerMoney( playerid, randMoney );
new
szStr[ 128 ],
szStr1[128],
usrName[ 24 ];
GetPlayerName( playerid, usrName, 24 );
format( szStr, 128, "[ROBBERY] %s has robbed $%d from Idlewood Pizza!", usrName, randMoney );
SendClientMessageToAll( ROB, szStr );
format( szStr, 128, "[ROBBERY INFO] Robbery succesfull! You have earned $%d and 1 score from the robbery.", randMoney );
SendClientMessage( playerid, INFO, szStr );
pRobbingP[ playerid ] = false;
SetTimer( "pizzaDelay", 90000, false );
format(szStr1, sizeof (szStr1), "~g~You have succesfuly robbed $%d from Idlewood Pizza!", randMoney);
GameTextForPlayer( playerid, szStr1, 3000, 3 );
SetPlayerScore(playerid, GetPlayerScore(playerid) +1 );
}
public robSexShop( playerid )
{
new
randMoney = random( 96000 );
GivePlayerMoney( playerid, randMoney );
new
szStr[ 128 ],
szStr1[128],
usrName[ 24 ];
GetPlayerName( playerid, usrName, 24 );
format( szStr, 128, "[ROBBERY] %s has robbed $%d from Idlewood Pizza!", usrName, randMoney );
SendClientMessageToAll( ROB, szStr );
format( szStr, 128, "[ROBBERY INFO] Robbery succesfull! You have earned $%d and 1 score from the robbery.", randMoney );
SendClientMessage( playerid, INFO, szStr );
pRobbingP[ playerid ] = false;
SetTimer( "pizzaDelay", 90000, false );
format(szStr1, sizeof (szStr1), "~g~You have succesfuly robbed $%d from Idlewood Pizza!", randMoney);
GameTextForPlayer( playerid, szStr1, 3000, 3 );
SetPlayerScore(playerid, GetPlayerScore(playerid) +1 );
}
forward SexShopDelay( );
public SexShopDelay( )
{
SevenRobbed = false;
return true;
}
forward SevenDelay( );
public SevenDelay( )
{
SevenRobbed = false;
return true;
}
error when i made else my robing 2
PHP код:
|
if(/*CONDITION*/)
{
//do stuff
}
else
{
//do other stuff
}
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;
}
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 Код:
pawn Код:
|
#include <a_samp>
#include <Streamer>
#include <zcmd>
#define RED -1
#define ROB -1
#define INFO -1
forward robSeven( playerid ); //Add this to the top of your script under your includes!
forward robSexShop( playerid ); //Add this to the top of your script under your includes!
//IDLEWOOD PIZZA
new
robTimerP[ MAX_PLAYERS ],
cp_Seven,
cp_SexShop,
bool: pRobbingP[ MAX_PLAYERS ],
bool: SevenRobbed;
public OnGameModeInit()
{
cp_SexShop = CreateDynamicCP(-104.1407,-22.6708,1000.7188, 3.0, .interiorid = -1);
cp_Seven = CreateDynamicCP(-23.4826,-55.6319,1003.5469, 3.0, .interiorid = -1);
return 1;
}
public OnPlayerEnterDynamicCP( playerid, checkpointid )
{
if( pRobbingP[ playerid ] )
{
if ( checkpointid == cp_Seven )
{
pRobbingP[ playerid ] = false;
KillTimer( robTimerP[ playerid ] );
SevenRobbed = false;
GameTextForPlayer( playerid, "~r~You have failed the robbery!", 1000, 3 );
}
}
if( pRobbingP[ playerid ] )
{
if ( checkpointid == cp_SexShop )
{
pRobbingP[ playerid ] = false;
KillTimer( robTimerP[ playerid ] );
SevenRobbed = false;
GameTextForPlayer( playerid, "~r~You have failed the robbery!", 1000, 3 );
}
}
return true;
}
CMD:robbery( playerid, params[ ] )
{
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 true;
}
public robSeven( playerid )
{
new
randMoney = random( 96000 );
GivePlayerMoney( playerid, randMoney );
new
szStr[ 128 ],
szStr1[128],
usrName[ 24 ];
GetPlayerName( playerid, usrName, 24 );
format( szStr, 128, "[ROBBERY] %s has robbed $%d from Idlewood Pizza!", usrName, randMoney );
SendClientMessageToAll( ROB, szStr );
format( szStr, 128, "[ROBBERY INFO] Robbery succesfull! You have earned $%d and 1 score from the robbery.", randMoney );
SendClientMessage( playerid, INFO, szStr );
pRobbingP[ playerid ] = false;
SetTimer( "pizzaDelay", 90000, false );
format(szStr1, sizeof (szStr1), "~g~You have succesfuly robbed $%d from Idlewood Pizza!", randMoney);
GameTextForPlayer( playerid, szStr1, 3000, 3 );
SetPlayerScore(playerid, GetPlayerScore(playerid) +1 );
}
public robSexShop( playerid )
{
new
randMoney = random( 96000 );
GivePlayerMoney( playerid, randMoney );
new
szStr[ 128 ],
szStr1[128],
usrName[ 24 ];
GetPlayerName( playerid, usrName, 24 );
format( szStr, 128, "[ROBBERY] %s has robbed $%d from Idlewood Pizza!", usrName, randMoney );
SendClientMessageToAll( ROB, szStr );
format( szStr, 128, "[ROBBERY INFO] Robbery succesfull! You have earned $%d and 1 score from the robbery.", randMoney );
SendClientMessage( playerid, INFO, szStr );
pRobbingP[ playerid ] = false;
SetTimer( "pizzaDelay", 90000, false );
format(szStr1, sizeof (szStr1), "~g~You have succesfuly robbed $%d from Idlewood Pizza!", randMoney);
GameTextForPlayer( playerid, szStr1, 3000, 3 );
SetPlayerScore(playerid, GetPlayerScore(playerid) +1 );
}
forward SexShopDelay( );
public SexShopDelay( )
{
SevenRobbed = false;
return true;
}
forward SevenDelay( );
public SevenDelay( )
{
SevenRobbed = false;
return true;
}
if(/*some condition defined by you*/) |
D:\tryrobs.pwn(90) : error 017: undefined symbol "SexShopRobbed" |
if ( SexShopRobbed ) |
bool:SexShopRobbed;//is wrong
//you have to do it like:
new bool:SexShopRobbed;
if(someVar == 1) //continue to do stuff...