CMD:robthis(playerid, params[])
{
#pragma unused params // we dont need the params
if(IsPlayerInDynamicCP(playerid, CP_tatoo)) // Checking if player is in the checkpoint
{
if(tatoorobbedrecently >=1) //checking if tatoo shop has been robbed recently
{
SendClientMessage(playerid, COLOR_RED, "The shop has been robbed recenty. Please wait"); // sending error message
return 1;
}
ROBBING_TATOO[playerid] = 5; // setting the robbery timer
tatoorobbedrecently =30; // Time the players needs to wait for starting an another robbery in the same place
}
else {
SendClientMessage(playerid, COLOR_RED, "ERROR:You need to be near the Shop"); // Sends a SCM Your not on a Checkpoint.
}
return 1;
}
SetTimer("Test", 1000, false); // Initiates a timer, use in functions
// "Test" - The public function to call when the timer is done
// 1000 - The time untill the timer is done in milliseconds
// false - If the timer should repeat infinitely(true) or not(false), use KillTimer to stop repeating timers
forward Test(); // Forwards the public function
public Test() // The public function that get's called when the timer is done
{
// Codes
}
CMD:robbank(playerid,params[]) { #pragma unused params if(PlayerInfo[playerid][team] == TEAM_LVCOP || PlayerInfo[playerid][team] == TEAM_LSCOP || PlayerInfo[playerid][team] == TEAM_SWAT || PlayerInfo[playerid][team] == TEAM_ARMY || PlayerInfo[playerid][team] == TEAM_LVARMY) SendClientMessage(playerid, COLOR_RED, "You cannot use this command!"); else { new rbank; rbank = random(5); if(GetPlayerWantedLevel(playerid) > 0) { SendClientMessage(playerid,COLOR_RED,"You must be innocent to rob The Bank"); return 1; } if(CloseToBank(playerid) == 999) { SendClientMessage(playerid,COLOR_RED,"You can only rob the bank from the Transactions Checkpoint inside the bank"); return 1; } if(BankRobbedRecently >=1 ) { SendClientMessage(playerid,COLOR_ERROR,"The Bank has been robbed recenty. Please wait"); return 1; } if(GetPlayerWantedLevel(playerid) == 0 && PlayerInfo[playerid][team] != TEAM_LVCOP || PlayerInfo[playerid][team] != TEAM_LSCOP || PlayerInfo[playerid][team] != TEAM_SWAT || PlayerInfo[playerid][team] != TEAM_ARMY || PlayerInfo[playerid][team] != TEAM_LVARMY) { if(BankRobbedRecently == 1) { GameTextForPlayer(playerid, "~r~The Bank~n~~w~robbed recently~n~try again later",5000,5); return 1; } if(BankRobbedRecently == 0) { switch(rbank) { case 2: { GameTextForPlayer(playerid, "~r~Robbery Failed",5000,3); new plwl = GetPlayerWantedLevel(playerid); SetPlayerWantedLevel(playerid, plwl +1 ); BankRobbedRecently = 1; SetTimer("BankRobbedRecentlyTimer",45000,0); return 1; } case 4: { GameTextForPlayer(playerid, "~r~Robbery Failed",5000,3); new plwl = GetPlayerWantedLevel(playerid); SetPlayerWantedLevel(playerid, plwl +1 ); BankRobbedRecently = 1; SetTimer("BankRobbedRecentlyTimer",45000,0); return 1; } case 5: { GameTextForPlayer(playerid, "~r~Robbery Failed",5000,3); new plwl = GetPlayerWantedLevel(playerid); SetPlayerWantedLevel(playerid, plwl +1 ); BankRobbedRecently = 1; SetTimer("BankRobbedRecentlyTimer",45000,0); return 1; } } new rcash = random(100000); GivePlayerMoney(playerid,rcash); new str[128]; format(str,sizeof(str),"~w~ROBBED~n~$%d",rcash); GameTextForPlayer(playerid,str,5000,3); new plwl = GetPlayerWantedLevel(playerid); SetPlayerWantedLevel(playerid, plwl +3); new pname[24]; GetPlayerName(playerid, pname, 24); for(new i=0;i<GetMaxPlayers();i++) { if(LawEnforcementRadio[i] == 1) { format(str,sizeof(str),"DISPATCH: (BANK ROBBERY) %s(%d) has robbed LV City Bank",pname,playerid); SendClientMessage(i,COLOR_ROYALBLUE,str); } } format(str,sizeof(str),"%s(%d) has just robbed $%d from LV City Bank",pname,playerid,rcash); SendClientMessageToAll(COLOR_AQUA,str); BankRobbedRecently = 1; SetTimer("BankRobbedRecentlyTimer",45000,0); return 1; } } else { return 1; } } RecentCrime[playerid] += 200; return 1; } |
CMD:robthis(playerid, params[]) { #pragma unused params // we dont need the params if(IsPlayerInDynamicCP(playerid, CP_tatoo)) // Checking if player is in the checkpoint { if(tatoorobbedrecently >=1) //checking if tatoo shop has been robbed recently { SendClientMessage(playerid, COLOR_RED, "The shop has been robbed recenty. Please wait"); // sending error message return 1; } ROBBING_TATOO[playerid] = 5; // setting the robbery timer tatoorobbedrecently =1; // Time the players needs to wait for starting an another robbery in the same place } else { SendClientMessage(playerid, COLOR_RED, "ERROR:You need to be near the Shop"); // Sends a SCM Your not on a Checkpoint. } return 1; } |