17.04.2012, 01:54
How to make a bank robbery system for my RP server? Any Hints?
if(strcmp(cmd, "/robbank", true) == 0) { if(PlayerInfo[playerid][pLevel] < 4) { SendClientMessage(playerid, COLOR_GREY, " You must be a level 4 or higher to be able to rob the bank."); return 1; } if(IsACop(playerid)) { SendClientMessage(playerid, COLOR_GREY, " Law Enforcement Officials cannot rob the bank."); return 1; } if(!IsPlayerInRangeOfPoint(playerid, 3.0, 1448.44, -988.52, 1639.78)) { SendClientMessage(playerid, COLOR_GREY, " You are not at the bank safe."); return 1; } if(TimeAfterBankJob < TIME_BETWEEN_BANKJOBS) { new bjt; bjt = TIME_BETWEEN_BANKJOBS - TimeAfterBankJob; format(string, sizeof(string), " You must wait %d hours before making the next bank robbery attempt.", bjt); SendClientMessage(playerid, COLOR_GREY, string); return 1; } if(BankJobPlayer < 999 && BankJobPlayer != playerid) { SendClientMessage(playerid, COLOR_GREY, " Someone is already robbing the bank."); return 1; } if(BankJobPlayer == playerid) { format(string, 256, " You're already robbing the bank! %d minutes left.", BankJobTime / 2); SendClientMessage(playerid, COLOR_GREY, string); return 1; } new Cops = 0; for(new i = 0; i < MAX_PLAYERS; i++) { if(IsACop(i)) { Cops += 1; } } if(!(Cops >= 3)) { SendClientMessage(playerid,COLOR_GREY," There must be at least 3 Law Enforcement Officials online."); return 1; } format(string, 256, "You have started the robbery, you must stay inside the bank for %d minutes.", BANK_JOB_TIME/2); SendClientMessage(playerid, COLOR_WHITE, string); if(PlayerInfo[playerid][pWantedLevel] <= 1) { PlayerInfo[playerid][pWantedLevel] += 5; } else if(PlayerInfo[playerid][pWantedLevel] >= 2) { PlayerInfo[playerid][pWantedLevel] = 6; } SetPlayerCriminal(playerid, 999, "Bank Robbery"); format(string, 256, "City Alert: The Los Santos Bank is being robbed!"); SendClientMessageToAll(COLOR_LIGHTBLUE, string); BankJobTime = BANK_JOB_TIME; BankJobPlayer = playerid; return 1; }
CMD:robbank(playerid, params[]) { if(PlayerInfo[playerid][pLevel] < 4) { SendClientMessage(playerid, COLOR_GREY, " You must be a level 4 or higher to be able to rob the bank."); return 1; } if(IsACop(playerid)) { SendClientMessage(playerid, COLOR_GREY, " Law Enforcement Officials cannot rob the bank."); return 1; } if(!IsPlayerInRangeOfPoint(playerid, 3.0, 1448.44, -988.52, 1639.78)) { SendClientMessage(playerid, COLOR_GREY, " You are not at the bank safe."); return 1; } if(TimeAfterBankJob < TIME_BETWEEN_BANKJOBS) { new bjt; bjt = TIME_BETWEEN_BANKJOBS - TimeAfterBankJob; format(string, sizeof(string), " You must wait %d hours before making the next bank robbery attempt.", bjt); SendClientMessage(playerid, COLOR_GREY, string); return 1; } if(BankJobPlayer < 999 && BankJobPlayer != playerid) { SendClientMessage(playerid, COLOR_GREY, " Someone is already robbing the bank."); return 1; } if(BankJobPlayer == playerid) { format(string, 256, " You're already robbing the bank! %d minutes left.", BankJobTime / 2); SendClientMessage(playerid, COLOR_GREY, string); return 1; } new Cops = 0; for(new i = 0; i < MAX_PLAYERS; i++) { if(IsACop(i)) { Cops += 1; } } if(!(Cops >= 3)) { SendClientMessage(playerid,COLOR_GREY," There must be at least 3 Law Enforcement Officials online."); return 1; } format(string, 256, "You have started the robbery, you must stay inside the bank for %d minutes.", BANK_JOB_TIME/2); SendClientMessage(playerid, COLOR_WHITE, string); if(PlayerInfo[playerid][pWantedLevel] <= 1) { PlayerInfo[playerid][pWantedLevel] += 5; } else if(PlayerInfo[playerid][pWantedLevel] >= 2) { PlayerInfo[playerid][pWantedLevel] = 6; } SetPlayerCriminal(playerid, 999, "Bank Robbery"); format(string, 256, "City Alert: The Los Santos Bank is being robbed!"); SendClientMessageToAll(COLOR_LIGHTBLUE, string); BankJobTime = BANK_JOB_TIME; BankJobPlayer = playerid; return 1; }