11.07.2016, 12:53
Help
new PoliceMan[MAX_PLAYERS]; if(PoliceMan[playerid] == 1) return SendClientMessage(playerid, -1, "You're a cop!");
#include a_samp #include sscanf2 #include zcmd new bool:Arrested[MAX_PLAYERS], TimeArrested[MAX_PLAYERS]; main() { SetTimer("CheckArrested", 1000, true); } CMD:buycop(playerid) { if(GetPlayerMoney(playerid) < 5000) return SendClientMessage(playerid, -1, "You don't have money [$ 5.000]."); GivePlayerMoney(playerid, - 5000); SendClientMessage(playerid, -1, "Now you is a Cop!"); return 1; } CMD:arrest(playerid, params[]) { new Target, Time, Reason[30]; if(sscanf(params, "uis[30]", Target, Time, Reason)) return SendClientMessage(playerid, -1, "/arrest [name/id] [time (minutes)] [reason]"); if(!IsPlayerConnected(Target)) return SendClientMessage(playerid, -1, "PlayerID not connected."); if(Time < 0) return SendClientMessage(playerid, -1, "Invalid time."); TogglePlayerControllable(Target, 0); TimeArrested[Target] = Time * 60 + gettime(); Arrested[Target] = true; return 1; } forward CheckArrested(); public CheckArrested() { for(new i = 0; i < MAX_PLAYERS; ++ i) { if(!IsPlayerConnected(i)) continue; if(Arrested[i] == true) { if(TimeArrested[i] > gettime()) TimeArrested[i] --; else Arrested[i] = false, TimeArrested[i] = 0; } } }