06.10.2016, 10:08
Hey there. I made /robstore command and a cooldown of 20 sec for it. But it can be abused and the player can farm scores in a specific store. So can i make a timer of 5 minutes of the store which was robbed?
Код:
CMD:robstore(playerid, params[]) { if(Store1(playerid) || Store2(playerid) || Store3(playerid)) { Robbingfix[playerid] = 1; // Don't remove this or robstore cmd will get bugged. if(gTeam[playerid] == LSPD) { SCM(playerid, COLOR_RED, "[ERROR]: COPS can't perform this action!"); } if(Robbing[playerid] == 0) { Robbing[playerid] = 1; PlayerInfo[playerid][pWantedlevel] = 1; switch(pWantedlevel) { case 0: SetPlayerColor(playerid, COLOR_WHITE); case 1: SetPlayerColor(playerid, COLOR_YELLOW); case 2: SetPlayerColor(playerid, COLOR_YELLOW); case 3: SetPlayerColor(playerid, COLOR_YELLOW); case 4: SetPlayerColor(playerid, COLOR_ORANGE); case 5: SetPlayerColor(playerid, COLOR_ORANGE); case 6: SetPlayerColor(playerid, COLOR_ORANGE); case 7: SetPlayerColor(playerid, COLOR_ORANGE); default: SetPlayerColor(playerid, COLOR_RED); } Robbingfix[playerid] = 1; SetTimerEx("Robbing2", 45000, false, "i", playerid); SendClientMessage(playerid, COLOR_YELLOW, "[INFORMATION]: Robbery has been started, please wait 45 seconds!"); } if(Robbing[playerid] == 1 && Robbingfix[playerid] == 0) { SCM(playerid, -1, "NOTE: You need to wait 20 seconds before robbing another store."); } } return 1; }
Код:
stock Store1(playerid) { if(IsPlayerInRangeOfPoint(playerid, 7.0, 384.808624,173.804992,1008.382812) || IsPlayerInRangeOfPoint(playerid, 7.0, 381.169189,-188.803024,1000.632812) || IsPlayerInRangeOfPoint(playerid, 7.0, 373.825653,-117.270904,1001.499511)) { return 1; } return 0; } stock Store2(playerid) { if(IsPlayerInRangeOfPoint(playerid, 7.0, 375.962463,-65.816848,1001.507812) || IsPlayerInRangeOfPoint(playerid, 7.0, 226.293991,-7.431529,1002.210937) || IsPlayerInRangeOfPoint(playerid, 7.0, -25.132598,-139.066986,1003.546875)) { return 1; } return 0; } stock Store3(playerid) { if(IsPlayerInRangeOfPoint(playerid, 7.0, 226.293991,-7.431529,1002.210937) || IsPlayerInRangeOfPoint(playerid, 7.0, 226.293991,-7.431529,1002.210937)) { return 1; } return 0; }