06.06.2017, 14:08
Code:
CMD:rob(playerid, params[]) { new tid, str[256], Float:x, Float:y, Float:z, RCash; GetPlayerPos(tid, x, y, z); if(gTeam[playerid] != CIVI) return SCM(playerid, RED, ""COL_BLUE"[ERROR]: {FFFFFF}A law enforcer can not rob"); if(RobTime[playerid] == 1) return SCM(playerid, RED, ""COL_BLUE"[ERROR]: {FFFFFF}Please wait before robbing someone again."); if(sscanf(params, "u", tid)) return SCM(playerid, BLREN, ""COL_RED"[USAGE]:{FFFFFF}/rob (playerid/partofname)"); if(tid == playerid) return SCM(playerid, RED, ""COL_BLUE"[ERROR]: {FFFFFF}You cannot rob yourself!"); if(IsPlayerPaused(playerid)) return SCM(playerid, RED, ""COL_BLUE"[ERROR]: {FFFFFF}%s is paused!", GetPlayerNameEx(tid)); if(!IsPlayerConnected(tid)) return ErrorMessage(playerid, 1); if(IsPlayerInAnyVehicle(playerid)) { if(GetPlayerVehicleID(playerid) != GetPlayerVehicleID(tid)) return SCM(playerid, RED, ""COL_BLUE"[ERROR]: {FFFFFF}%s has to be in the same vehicle as you to be able to rob!", GetPlayerNameEx(tid)); } return 1; }
Code:
if(IsPlayerInAnyVehicle(playerid)) { if(GetPlayerVehicleID(playerid) != GetPlayerVehicleID(tid)) return SCM(playerid, RED, ""COL_BLUE"[ERROR]: {FFFFFF}%s has to be in the same vehicle as you to be able to rob!", GetPlayerNameEx(tid)); }
and
Code:
if(IsPlayerPaused(playerid)) return SCM(playerid, RED, ""COL_BLUE"[ERROR]: {FFFFFF}%s is paused!", GetPlayerNameEx(tid));
Code:
public IsPlayerPaused(playerid) return Paused[playerid]; public PauseCheck() { new ps; for(new id=0; id < MAX_PLAYERS; id++) { if(!IsPlayerConnected(id)) continue; ps = GetPlayerState(id); if(ps != PLAYER_STATE_ONFOOT && ps != PLAYER_STATE_DRIVER && ps != PLAYER_STATE_PASSENGER) continue; for(new x = FPS_CHECKS-1; x > 0; x--) { PlayerFPS[id][x] = PlayerFPS[id][x - 1]; } PlayerFPS[id][0] = GetPlayerDrunkLevel(id); for(new x = 0; x < FPS_CHECKS; x++) { if(x == FPS_CHECKS - 1) { if(Paused[id] != 1) PlayerHasPaused(id); Paused[id] = 1; break; } if(PlayerFPS[id][x] == PlayerFPS[id][x + 1]) continue; if(Paused[id] != 0) PlayerHasUnpaused(id); Paused[id] = 0; break; } if(PlayerFPS[id][0] < 100) { SetPlayerDrunkLevel(id, 2000); } } return 1; }