CMD:oprison(playerid, params[])
{
new playerb[32], string[128], file[32], time;
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
if(sscanf(params, "s[32]is[128]", playerb, time, params)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /oprison [playername] [time] [reason]");
if(RPIDFN(playerb) != INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, "Player is connected to the server, use /prison instead.");
format(file, sizeof(file), "users/%s.ini", playerb);
if(!dini_Exists(file)) return SendClientMessage(playerid, COLOR_GREY, "Player name not found.");
if(PlayerInfo[playerid][pAdmin] < dini_Int(file, "Admin")) return SendClientMessage(playerid, COLOR_GREY, "Player has a higher admin level than you.");
format(string, sizeof(string), "AdmCmd: %s has been offline-prisoned by %s, reason: %s", playerb, RPN(playerid), params);
SendClientMessageToAll(COLOR_LIGHTRED, string);
format(string, sizeof(string), "AdmCmd: %s has been offline-prisoned by %s, reason: %s", playerb, RPN(playerid) , params);
// Prisoning
dini_IntSet(file, "pPrison", 1);
// Prisonreason
dini_Set(file, "pPrisonReason", params);
dini_Set(file, "pPrisonBy", RPNU(playerid));
dini_IntSet(file, "pPrisonTime", time);
return 1;
}
if(PlayerInfo[playerid][pPrison] != 0) { new player = [MAX_PLAYERS] if(PlayerInfo[playerid][pPrisonTime] > 0) { SetPlayerPos(playerid, x, y, z); SetPlayerVirtualWorld(playerid, player++); SetPlayerInterior(playerid, InteriorID); SendClientMessage(playerid, -1, "ADMIN NOTICE: You have not completed your admin jail sentence - You have been returned to complete it"); SetTimerEx("CheckPrison", 1000, true, "i", playerid); } return 1; } forward CheckPrison(playerid); public CheckPrison(playerid) { if(IsPlayerConnected(playerid)) { if(PlayerInfo[playerid][pPrisonTime] > 0) { PlayerInfo[playerid][pPrisonTime] --; return 1; } else if(PlayerInfo[playerid][pPrisonTime] == 0) { PlayerInfo[playerid][pPrison] == 0; PlayerInfo[playerid][pPrisonReason] == 0; PlayerInfo[playerid][pPrisonedBy] == 0; SetPlayerPos(playerid, x, y, z); SetPlayerVirtualWorld(playerid, 0); SetPlayerInterior(playerid, 0); SendClientMessage(playerid, -1, "ADMIN NOTICE: You have been released from jail - Please try not to break the rules again"); KillTimerEx("CheckPrison"); return 1; } } return 1; }
Hopefully this code below will give you a little insight into what you will be required to complete in order for your code to check if a player has been prisoned or not
Please place the first peice of coding where you check where the player spawns. Код:
if(PlayerInfo[playerid][pPrison] != 0) { new player = [MAX_PLAYERS] if(PlayerInfo[playerid][pPrisonTime] > 0) { SetPlayerPos(playerid, x, y, z); SetPlayerVirtualWorld(playerid, player++); SetPlayerInterior(playerid, InteriorID); SendClientMessage(playerid, -1, "ADMIN NOTICE: You have not completed your admin jail sentence - You have been returned to complete it"); SetTimerEx("CheckPrison", 1000, true, "i", playerid); } return 1; } forward CheckPrison(playerid); public CheckPrison(playerid) { if(IsPlayerConnected(playerid)) { if(PlayerInfo[playerid][pPrisonTime] > 0) { PlayerInfo[playerid][pPrisonTime] --; return 1; } else if(PlayerInfo[playerid][pPrisonTime] == 0) { PlayerInfo[playerid][pPrison] == 0; PlayerInfo[playerid][pPrisonReason] == 0; PlayerInfo[playerid][pPrisonedBy] == 0; SetPlayerPos(playerid, x, y, z); SetPlayerVirtualWorld(playerid, 0); SetPlayerInterior(playerid, 0); SendClientMessage(playerid, -1, "ADMIN NOTICE: You have been released from jail - Please try not to break the rules again"); KillTimerEx("CheckPrison"); return 1; } } return 1; } |
look at this and try it
http://pastebin.com/4htRddeK |
C:\Users\Davey\Desktop\Divoro\gamemodes\d-rp.pwn(23872) : error 035: argument type mismatch (argument 1)
C:\Users\Davey\Desktop\Divoro\gamemodes\d-rp.pwn(23899) : error 010: invalid function or declaration
C:\Users\Davey\Desktop\Divoro\gamemodes\d-rp.pwn(23901) : error 010: invalid function or declaration
C:\Users\Davey\Desktop\Divoro\gamemodes\d-rp.pwn(23909) : error 010: invalid function or declaration
C:\Users\Davey\Desktop\Divoro\gamemodes\d-rp.pwn(23923) : warning 215: expression has no effect
C:\Users\Davey\Desktop\Divoro\gamemodes\d-rp.pwn(23924) : warning 215: expression has no effect
C:\Users\Davey\Desktop\Divoro\gamemodes\d-rp.pwn(23925) : error 017: undefined symbol "pPrisonedBy"
C:\Users\Davey\Desktop\Divoro\gamemodes\d-rp.pwn(23925) : warning 215: expression has no effect
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
5 Errors.