06.12.2013, 14:27
Quote:
I've tried to make a warn and prison command in once, but I really don't know how to. I want it something like this but also you'll get a warning.
Код:
CMD:wprison(playerid, params[]) { if(PlayerInfo[playerid][pAdmin] >= 3) { new string[128], giveplayerid, minutes, reason[64]; if(sscanf(params, "ids[64]", giveplayerid, minutes, reason)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /wprison [playerid] [minutes] [reason]"); if(IsPlayerConnected(giveplayerid)) { if(PlayerInfo[giveplayerid][pAdmin] >= PlayerInfo[playerid][pAdmin]) { SendClientMessageEx(playerid, COLOR_WHITE, "You can't perform this action on an equal or higher level administrator."); return 1; } SetPlayerArmedWeapon(giveplayerid, 0); if(GetPVarInt(giveplayerid, "IsInArena") >= 0) { LeavePaintballArena(giveplayerid, GetPVarInt(giveplayerid, "IsInArena")); } GameTextForPlayer(giveplayerid, "~w~Welcome to ~n~~r~Fort DeMorgan", 5000, 3); new year, month,day; ResetPlayerWeaponsEx(giveplayerid); getdate(year, month, day); format(string, sizeof(string), "AdmCmd: %s has been warned and prisoned(%s th offence) by %s, reason: %s(%d-%d-%d)", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason, month, day, year); Log("logs/admin.log", string); format(string, sizeof(string), "AdmCmd: %s has been warned and prisoned (%th offence) by %s, reason: %s", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason); SendClientMessageToAllEx(COLOR_LIGHTRED, string); WantedPoints[giveplayerid] = 0; PlayerInfo[giveplayerid][pWantedLevel] = 0; SetPlayerWantedLevel(giveplayerid, 0); PlayerInfo[giveplayerid][pJailed] = 4; PlayerInfo[giveplayerid][pJailTime] = minutes*60; format(PlayerInfo[giveplayerid][pPrisonReason], 128, "[OOC][PRISON] %s", reason); format(PlayerInfo[giveplayerid][pPrisonedBy], MAX_PLAYER_NAME, "%s", GetPlayerNameEx(playerid)); PhoneOnline[giveplayerid] = 1; TogglePlayerControllable(giveplayerid, 0); GameTextForPlayer(giveplayerid, "Objects loading...", 4000, 5); SetPVarInt(giveplayerid, "LoadingObjects", 1); SetTimerEx("SafeLoadObjects", 4000, 0, "d", giveplayerid); SetPlayerInterior(giveplayerid, 1); PlayerInfo[giveplayerid][pInt] = 1; new rand = random(sizeof(OOCPrisonSpawns)); Streamer_UpdateEx(giveplayerid, OOCPrisonSpawns[rand][0], OOCPrisonSpawns[rand][1], OOCPrisonSpawns[rand][2]); SetPlayerPos(giveplayerid, OOCPrisonSpawns[rand][0], OOCPrisonSpawns[rand][1], OOCPrisonSpawns[rand][2]); SetPlayerSkin(giveplayerid, 50); SetPlayerColor(giveplayerid, TEAM_APRISON_COLOR); } } else { SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!"); } return 1; } |
Wouldn't it be;
(i am not fully confirmed)
Код:
CMD:wprison(playerid, params[]) { if(PlayerInfo[playerid][pAdmin] >= 3) { new string[128], giveplayerid, minutes, reason[64]; if(sscanf(params, "ids[64]", giveplayerid, minutes, reason)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /wprison [playerid] [minutes] [reason]"); if(IsPlayerConnected(giveplayerid)) { if(PlayerInfo[giveplayerid][pAdmin] >= PlayerInfo[playerid][pAdmin]) { SendClientMessageEx(playerid, COLOR_WHITE, "You can't perform this action on an equal or higher level administrator."); return 1; } SetPlayerArmedWeapon(giveplayerid, 0); if(GetPVarInt(giveplayerid, "IsInArena") >= 0) { LeavePaintballArena(giveplayerid, GetPVarInt(giveplayerid, "IsInArena")); } GameTextForPlayer(giveplayerid, "~w~Welcome to ~n~~r~Fort DeMorgan", 5000, 3); new year, month,day; ResetPlayerWeaponsEx(giveplayerid); getdate(year, month, day); format(string, sizeof(string), "AdmCmd: %s has been warned and prisoned(%s th offence) by %s, reason: %s(%d-%d-%d)", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason, month, day, year); Log("logs/admin.log", string); format(string, sizeof(string), "AdmCmd: %s has been warned and prisoned (%th offence) by %s, reason: %s", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason); SendClientMessageToAllEx(COLOR_LIGHTRED, string); WantedPoints[giveplayerid] = 0; PlayerInfo[giveplayerid][pWantedLevel] = 0; SetPlayerWantedLevel(giveplayerid, 0); PlayerInfo[giveplayerid][pJailed] = 4; PlayerInfo[giveplayerid][pJailTime] = minutes*60; format(PlayerInfo[giveplayerid][pPrisonReason], 128, "[OOC][PRISON] %s", reason); format(PlayerInfo[giveplayerid][pPrisonedBy], MAX_PLAYER_NAME, "%s", GetPlayerNameEx(playerid)); PhoneOnline[giveplayerid] = 1; TogglePlayerControllable(giveplayerid, 0); GameTextForPlayer(giveplayerid, "Objects loading...", 4000, 5); SetPVarInt(giveplayerid, "LoadingObjects", 1); SetTimerEx("SafeLoadObjects", 4000, 0, "d", giveplayerid); SetPlayerInterior(giveplayerid, 1); PlayerInfo[giveplayerid][pInt] = 1; new rand = random(sizeof(OOCPrisonSpawns)); Streamer_UpdateEx(giveplayerid, OOCPrisonSpawns[rand][0], OOCPrisonSpawns[rand][1], OOCPrisonSpawns[rand][2]); SetPlayerPos(giveplayerid, OOCPrisonSpawns[rand][0], OOCPrisonSpawns[rand][1], OOCPrisonSpawns[rand][2]); SetPlayerSkin(giveplayerid, 50); SetPlayerColor(giveplayerid, TEAM_APRISON_COLOR); } } else { SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!"); return 1; } }