I have problem in scripting
#8

Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
"stock"...


Dude, you probably have the variable defined outside of the functions reach.

Post up where you have them defined, in the gamemode (I notice you are using the includes folder for your GM).
Код:
task SyncUp[60000]()
{
	static
		string[215];

	SyncTime();
	SyncMinTime();

	for(new i = 0; i < MAX_PLANTS; i++)
	{
    	if(IsValidDynamicObject(Plants[i][pObjectSpawned]))
		{
    	    if(Plants[i][pExpires] > gettime())
			{
				switch(Plants[i][pPlantType])
				{
				    case 1:
				    {
				        if(Plants[i][pGrowth] < 45)
						{
       						switch(Plants[i][pDrugsSkill])
							{
								case 0 .. 50: Plants[i][pGrowth] += 1;
								case 51 .. 100: Plants[i][pGrowth] += 2;
								case 101 .. 200: Plants[i][pGrowth] += 3;
								case 201 .. 400: Plants[i][pGrowth] += 4;
								default: Plants[i][pGrowth] += 5;
							}
						}
				    }
				    case 2:
				    {
				        if(Plants[i][pGrowth] < 120) Plants[i][pGrowth] += 1;
						if(Plants[i][pGrowth] == 120)
						{
						    DestroyDynamicObject(Plants[i][pObjectSpawned]);
						    Plants[i][pObjectSpawned] = CreateDynamicObject(862, Plants[i][pPos][0], Plants[i][pPos][1], Plants[i][pPos][2], 0.0, 0.0, 0.0, Plants[i][pVirtual], Plants[i][pInterior]);
							Plants[i][pGrowth] = 121;
							Plants[i][pObject] = 862;
							format(string, sizeof(string), "Opium plant (%d) is ready to be picked.", i);
							Log("logs/plant.log", string);
						}
					}
				}
			}
			else if(Plants[i][pExpires] == 0) { }
			else
			{
			    format(string, sizeof(string), "Plant (%d) has expired.", i);
				Log("logs/plant.log", string);
			    DestroyPlant(i);
	[ERROR] -->   SavePlant(i);
			}
		}
	}
Код:
task ServerHeartbeat[1000]() {
    if(++AdminWarning == 15) {
		for(new z = 0; z < MAX_REPORTS; z++)
		{
			if(Reports[z][BeingUsed] == 1)
			{
				if(Reports[z][ReportPriority] == 1 || Reports[z][ReportPriority] == 2)
				{
					ABroadCast(COLOR_LIGHTRED,"A priority report is pending.", 2, true);
					break;
				}
			}
		}
		AdminWarning = 0;
	}
    static string[128];
	foreach(new i: Player)
	{
		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 || strfind(PlayerInfo[i][pPrisonReason], "[ISOLATE]", true) != -1) {
	   				SetPlayerInterior(i, 0);
					PlayerInfo[i][pInt] = 0;
					SetPlayerVirtualWorld(i, 0);
					PlayerInfo[i][pVW] = 0;
					SetPlayerPos(i, -2028.5829,-96.5533,35.1641);
				}
				else {
				 	SetPlayerInterior(i, 0);
					PlayerInfo[i][pInt] = 0;
					SetPlayerVirtualWorld(i, 0);
					PlayerInfo[i][pVW] = 0;
	    			SetPlayerPos(i, 1544.5059,-1675.5673,13.5585);
				}
				SetPlayerHealth(i, 100);
				PlayerInfo[i][pJailTime] = 0;
				PhoneOnline[i] = 0;
				SendClientMessageEx(i, COLOR_GRAD1,"   You have paid your debt to society.");
				GameTextForPlayer(i, "~g~Freedom~n~~w~Try to be a better citizen", 5000, 1);
	[ERROR] -->       ClearCrimes(i);
Код:
task hungerGames[1000]()
{
	new string[128];
	if(hgActive)
	{
		if(hgCountdown > 0)
		{
			hgCountdown--;

			format(string, sizeof(string), "Time left until start: %d", hgCountdown);
			for(new i = 0; i < MAX_PLAYERS; i++)
			{
				if(HungerPlayerInfo[i][hgInEvent] == 1)
				{
					PlayerTextDrawSetString(i, HungerPlayerInfo[i][hgTimeLeftText], string);
				}
			}

			if(hgCountdown == 300)
			{
				SendClientMessageToAll(COLOR_LIGHTBLUE, "The Hunger Games Event will start in 5 minutes, type /joinhunger to participate.");
			}
			else if(hgCountdown == 60)
			{
				SendClientMessageToAll(COLOR_LIGHTBLUE, "The Hunger Games Event will start in 1 minute, type /joinhunger to participate.");
			}
			else if(hgCountdown == 30)
			{
				for(new i = 0; i < MAX_PLAYERS; i++)
				{
					if(HungerPlayerInfo[i][hgInEvent] == 1)
					{
						SendClientMessageEx(i, COLOR_LIGHTBLUE, "* The event will be starting in 30 seconds...");
						SendClientMessageEx(i, COLOR_LIGHTBLUE, "* Godmode will be disabled and backpacks will be spawned in 30 seconds.");
					}
				}
			}
		}
		else if(hgCountdown == 0 && hgActive == 1)
		{
	ERROR --> LoadHGBackpacks();
Reply


Messages In This Thread
I have problem in scripting - by roncohen7 - 13.06.2016, 08:37
Re: I have problem in scripting - by Dayrion - 13.06.2016, 08:56
Re: I have problem in scripting - by roncohen7 - 13.06.2016, 09:00
Re: I have problem in scripting - by Dayrion - 13.06.2016, 10:39
Re: I have problem in scripting - by roncohen7 - 13.06.2016, 11:27
Re: I have problem in scripting - by Sew_Sumi - 13.06.2016, 11:30
Re: I have problem in scripting - by roncohen7 - 13.06.2016, 11:32
Re: I have problem in scripting - by roncohen7 - 13.06.2016, 11:36
Re: I have problem in scripting - by Nin9r - 13.06.2016, 12:34
Re: I have problem in scripting - by Sew_Sumi - 13.06.2016, 17:05

Forum Jump:


Users browsing this thread: 1 Guest(s)