SA-MP Forums Archive
ReleasePlayerFromPrison - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: ReleasePlayerFromPrison (/showthread.php?tid=658576)



ReleasePlayerFromPrison - EzeGODezE - 07.09.2018

undefined symbol help me fix it
ReleasePlayerFromPrison(i);

Код:
task PlayerHeartBeat[1000]() {
foreach(new i : Player)
{
		// alerttimer - Merged by Jingles
		if(AlertTime[i] != 0) AlertTime[i]--;

		new Float:playerArmour = GetArmour(i, playerArmour);
        // playertabbedloop - Merged by Jingles
        new
            iTick = gettime() - 1;

        if(floatround(playerArmour, floatround_round) < 0)
        {
            SetPlayerArmour(i, 0);
        }

		if(1 <= GetPlayerState(i) <= 3) {
			if(playerTabbed[i] >= 1) {
				if(++playerTabbed[i] >= 1200 && PlayerInfo[i][pAdmin] < 2) {
					SendClientMessageEx(i, COLOR_WHITE, "You have been automatically kicked for alt-tabbing.");
					return Disconnect(i);
				}
			}
			else if(++playerSeconds[i] < iTick && playerTabbed[i] == 0) {
				playerTabbed[i] = 1;
			}
			else if((IsPlayerInRangeOfPoint(i, 2.0, PlayerPos[i][0], PlayerPos[i][1], PlayerPos[i][2]) || InsidePlane[i] != INVALID_PLAYER_ID) && ++playerLastTyped[i] >= 10) {
				if(++playerAFK[i] >= 1200 && PlayerInfo[i][pAdmin] < 2) {
					SendClientMessageEx(i, COLOR_WHITE, "You have been automatically kicked for idling.");
					return Disconnect(i);
				}
			}
			else playerAFK[i] = 0;
			GetPlayerPos(i, PlayerPos[i][0], PlayerPos[i][1], PlayerPos[i][2]);
		}
		if(GetPVarType(i, "IsInArena") && GetPlayerVirtualWorld(i) == 0)
		{
			SendClientMessageEx(i, COLOR_WHITE, "SERVER: You have been kicked for PaintBall Exploiting.");
			format(szMiscArray, sizeof(szMiscArray), " %s(%d) (ID: %d) (IP: %s) has been kicked for attempting to Paint Ball Exploit.", GetPlayerNameEx(i), GetPlayerSQLId(i), i, GetPlayerIpEx(i));
			Log("logs/pbexploit.log", szMiscArray);
			SetTimerEx("KickEx", 1000, 0, "i", i);
		}
		// MoneyHeartBeat - Merged by Jingles
		if(gPlayerLogged{i})
		{
			if(IsSpawned[i] == 0 && PlayerInfo[i][pAdmin] < 1337)
			{
				SpawnKick[i]++;
				if(SpawnKick[i] >= 120)
				{
					IsSpawned[i] = 1;
					SpawnKick[i] = 0;

					SendClientMessageEx(i, COLOR_WHITE, "SERVER: You have been kicked for being AFK.");
					format(szMiscArray, sizeof(szMiscArray), " %s(%d) (ID: %d) (IP: %s) has been kicked for not being spawned over 2 minutes.", GetPlayerNameEx(i), GetPlayerSQLId(i), i, GetPlayerIpEx(i));
					Log("logs/spawnafk.log", szMiscArray);
					SetTimerEx("KickEx", 1000, 0, "i", i);
				}
			}
			if(IsSpawned[i] > 0 && SpawnKick[i] > 0)
			{
				SpawnKick[i] = 0;
			}
			if(GetPlayerPing(i) > MAX_PING)
			{
				if(playerTabbed[i] == 0)
				{
					if(GetPVarInt(i, "BeingKicked") != 1)
					{
						new ping;

						ping = GetPlayerPing(i);
						if(ping != 65535) // Invalid Ping
						{
							format(szMiscArray, sizeof(szMiscArray), "{AA3333}AdmWarning{FFFF00}: %s has just been kicked for %d ping (maximum: %d).", GetPlayerNameEx(i), ping, MAX_PING);
							ABroadCast(COLOR_YELLOW, szMiscArray, 2);
							SendClientMessageEx(i, COLOR_WHITE, "You have been kicked because your ping is higher than the maximum.");
							SetPVarInt(i, "BeingKicked", 1);
							SetTimerEx("KickEx", 1000, 0, "i", i);
						}
					}
				}
			}
			if(rBigEarT[i] > 0) {
				rBigEarT[i]--;
				if(rBigEarT[i] == 0) {
					DeletePVar(i, "BigEar");
					DeletePVar(i, "BigEarPlayer");
					SendClientMessageEx(i, COLOR_WHITE, "Big Ears has been turned off.");
				}
			}
			if(PlayerInfo[i][pTriageTime] != 0)	PlayerInfo[i][pTriageTime]--;
			if(PlayerInfo[i][pTicketTime] != 0)	PlayerInfo[i][pTicketTime]--;

			if(GetPVarInt(i, "InRangeBackup") > 0) SetPVarInt(i, "InRangeBackup", GetPVarInt(i, "InRangeBackup")-1);

			if(GetPVarInt(i, "HitCooldown") > 0) {

				SetPVarInt(i, "HitCooldown", GetPVarInt(i, "HitCooldown")-1);
				format(szMiscArray, sizeof(szMiscArray), "~n~~n~~n~~n~~n~~n~~n~~n~~n~~r~%d seconds until approval", GetPVarInt(i, "HitCooldown"));
				GameTextForPlayer(i, szMiscArray, 1100, 3);
				if(GetPVarInt(i, "HitCooldown") == 0)
				{
					GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~g~Contract Approved.", 5000, 3);
				}
			}
			if(GetPVarType(i, "IsTackled"))	{

				new copcount;
				foreach(new j: Player)
				{
					if(ProxDetectorS(4.0, i, j) && IsACop(j) && j != i)
					{
						copcount++;
					}
				}
				if(copcount == 0 || !ProxDetectorS(5.0, i, GetPVarInt(i, "IsTackled")))
				{
					SendClientMessageEx(i, COLOR_GREEN, "You're able to escape due to the cops leaving you unrestrained.");
					ClearTackle(i);
				}
				if(GetPVarInt(i, "TackleCooldown") > 0)
				{
					if(IsPlayerConnected(GetPVarInt(i, "IsTackled")) && GetPVarInt(GetPVarInt(i, "IsTackled"), "Tackling") == i)
					{
						format(szMiscArray, sizeof(szMiscArray), "~n~~n~~n~~n~~n~~n~~n~~n~~n~~r~%d", GetPVarInt(i, "TackleCooldown"));
						GameTextForPlayer(i, szMiscArray, 1100, 3);
						SetPVarInt(i, "TackleCooldown", GetPVarInt(i, "TackleCooldown")-1);
						if(GetPVarInt(i, "TackledResisting") == 2 && copcount <= 2 && GetPVarInt(i, "TackleCooldown") < 12) // resisting
						{
							new escapechance = random(100);
							switch(escapechance)
							{
								case 35,40,22,72,11..16, 62..64:
								{
									GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~g~ESCAPE!", 10000, 3);
									SendClientMessageEx(i, COLOR_GREEN, "You're able to push the officer off you and escape.");
									format(szMiscArray, sizeof(szMiscArray), "** %s pushes %s aside and is able to escape.", GetPlayerNameEx(i), GetPlayerNameEx(GetPVarInt(i, "IsTackled")));
									ProxDetector(30.0, i, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
									TogglePlayerControllable(GetPVarInt(i, "IsTackled"), 0);
									ApplyAnimation(GetPVarInt(i, "IsTackled"), "SWEET", "Sweet_injuredloop", 4.0, 1, 1, 1, 1, 0, 1);
									SetTimerEx("CopGetUp", 2500, 0, "i", GetPVarInt(i, "IsTackled"));
									ClearTackle(i);
								}
							}
						}
						else if(GetPVarInt(i, "TackledResisting") == 2 && copcount <= 3 && GetPVarInt(i, "TackleCooldown") < 12) // resisting
						{
							new escapechance = random(100);
							switch(escapechance)
							{
								case 35,40,22,62:
								{
									GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~g~ESCAPE!", 10000, 3);
									SendClientMessageEx(i, COLOR_GREEN, "You're able to push the officer off you and escape.");
									format(szMiscArray, sizeof(szMiscArray), "** %s pushes %s aside and is able to escape.", GetPlayerNameEx(i), GetPlayerNameEx(GetPVarInt(i, "IsTackled")));
									ProxDetector(30.0, i, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
									TogglePlayerControllable(GetPVarInt(i, "IsTackled"), 0);
									ApplyAnimation(GetPVarInt(i, "IsTackled"), "SWEET", "Sweet_injuredloop", 4.0, 1, 1, 1, 1, 0, 1);
									SetTimerEx("CopGetUp", 2500, 0, "i", GetPVarInt(i, "IsTackled"));
									ClearTackle(i);
								}
							}
						}
					}
				}
				else
				{
					if(ProxDetectorS(5.0, i, GetPVarInt(i, "IsTackled")))
					{
						CopGetUp(GetPVarInt(i, "IsTackled"));
					}
					SetPVarInt(GetPVarInt(i, "IsTackled"), "CopTackleCooldown", 30);
					ShowPlayerDialogEx(i, -1, DIALOG_STYLE_LIST, "Close", "Close", "Close", "Close");
					ClearTackle(i);
				}
			}
			if(GetPVarInt(i, "CopTackleCooldown") > 0)
			{
				SetPVarInt(i, "CopTackleCooldown", GetPVarInt(i, "CopTackleCooldown")-1);
			}
			if(GetPVarInt(i, "CantBeTackledCount") > 0)
			{
				SetPVarInt(i, "CantBeTackledCount", GetPVarInt(i, "CantBeTackledCount")-1);
			}
			if(PlayerInfo[i][pCash] != GetPlayerMoney(i))
			{
				ResetPlayerMoney(i);
				GivePlayerMoney(i, PlayerInfo[i][pCash]);
			}
			if(PlayerInfo[i][pGPS] > 0 && GetPVarType(i, "gpsonoff"))
			{
				new zone[28];
				GetPlayer3DZone(i, zone, MAX_ZONE_NAME);
				PlayerTextDrawSetString(i, GPS[i], zone);
			}
			if(GetPVarType(i, "Injured")) SetPlayerArmedWeapon(i, 0);
			if(GetPVarType(i, "IsFrozen")) TogglePlayerControllable(i, 0);
			if(PlayerCuffed[i] > 1) {
				SetHealth(i, 1000);
				SetArmour(i, GetPVarFloat(i, "cuffarmor"));
			}
		}

		if(playerTabbed[i] == 0) {

			switch(PlayerInfo[i][pLevel]) {

				case 0 .. 2: PlayerInfo[i][pPayCheck] += 1;
				case 3 .. 4: PlayerInfo[i][pPayCheck] += 2;
				case 5 .. 6: PlayerInfo[i][pPayCheck] += 3;
				case 7 .. 8: PlayerInfo[i][pPayCheck] += 4;
				case 9 .. 10: PlayerInfo[i][pPayCheck] += 5;
				case 11 .. 12: PlayerInfo[i][pPayCheck] += 6;
				case 13 .. 14: PlayerInfo[i][pPayCheck] += 7;
				case 15 .. 16: PlayerInfo[i][pPayCheck] += 8;
				case 17 .. 18: PlayerInfo[i][pPayCheck] += 9;
				case 19 .. 20: PlayerInfo[i][pPayCheck] += 10;
				default: PlayerInfo[i][pPayCheck] += 11;
			}
			if(++PlayerInfo[i][pConnectSeconds] >= 3600) {
				PayDay(i);
			}
		}

		if (GetPVarInt(i, "MailTime") > 0) SetPVarInt(i, "MailTime", GetPVarInt(i, "MailTime") - 1);
		else DeletePVar(i, "MailTime");

		if(PlayerInfo[i][pJudgeJailType] != 0 && PlayerInfo[i][pJudgeJailTime] > 0 && !PlayerInfo[i][pBeingSentenced]) PlayerInfo[i][pJudgeJailTime]--;
		if(PlayerInfo[i][pJudgeJailTime] <= 0 && PlayerInfo[i][pJudgeJailType] != 0) PlayerInfo[i][pJudgeJailType] = 0;


		if(playerTabbed[i] == 0)
		{
			if(PlayerInfo[i][pJailTime] > 0 && --PlayerInfo[i][pJailTime] <= 0)
			{
				if(strfind(PlayerInfo[i][pPrisonReason], "[IC]", true) != -1)
				{
			    	ShowPlayerDialogEx(i, DIALOG_STAYPRISON, DIALOG_STYLE_MSGBOX, "Notice", "Your initial prison time has ran out. However, you can choose to stay.\nWould you like to be released?", "Yes", "No");
				}
				else
				{
					ReleasePlayerFromPrison(i);
				}

			}
		}
			if(gettime() >= PlayerInfo[i][pPrisonWineTime] && GetPVarInt(i, "pPrisonMWine") == 1 && strfind(PlayerInfo[i][pPrisonReason], "[IC]", true) != -1)
			{
				SetPVarInt(i, "pPrisonMWine", 2);
			    SendClientMessageEx(i, COLOR_GREY, "Your pruno is finished. Go to your cell and type /finishpruno to collect it.");
			}
i think it must setplayerpos too


Re: ReleasePlayerFromPrison - SyS - 07.09.2018

The error clearly states it.The function ReleasePlayerFromPrison is not defined in the scope of your script.


Re: ReleasePlayerFromPrison - EzeGODezE - 07.09.2018

i need help defining it D:


Re: ReleasePlayerFromPrison - UFF - 07.09.2018

Код:
 
ShowPlayerDialogEx(i, DIALOG_STAYPRISON, DIALOG_STYLE_MSGBOX, "Notice", "Your initial prison time has ran out. However, you can choose to stay.\nWould you like to be released?", "Yes", "No");
Check the dialog code and check whether it has releaseplayerfromprison code.