Offline Prison help
#1

If you /oprison someone, you will see the text, that the player is prisoned, but if the player logs in, he is not prisoned

pawn Код:
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;
}
Reply
#2

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;
}
Reply
#3

Quote:
Originally Posted by Ciandlah
Посмотреть сообщение
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;
}
My Pawno is crashing from this code.
Reply
#4

look at this and try it
http://pastebin.com/4htRddeK
Reply
#5

Quote:
Originally Posted by rospar
Посмотреть сообщение
look at this and try it
http://pastebin.com/4htRddeK

pawn Код:
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.
Reply
#6

Someone??
Reply
#7

I can give you a idea about how to make it ,if the player is in prison then PlayerInfo[playerid][inPrison]=1;
and save it under OnPlayerDisconnect .For a time being avoid the timer and make manual /unjail system.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)