SA-MP Forums Archive
Time Update - 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: Time Update (/showthread.php?tid=637834)



Time Update - Uvais - 22.07.2017

Код:
C:\Users\i5\Desktop\Script\gamemodes\test.pwn(4140) : error 017: undefined symbol "SetVipTime"
D:\Users\i5\Desktop\Script\gamemodes\test.pwn(4140) : warning 215: expression has no effect
D:\Users\i5\Desktop\Script\gamemodes\test.pwn(4140) : error 001: expected token: ";", but found "]"
D:\Users\i5\Desktop\Script\gamemodes\test.pwn(4140) : error 029: invalid expression, assumed zero
D:\Users\i5\Desktop\Script\gamemodes\test.pwn(4140) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Code:

Код:
forward TimeUpdate();

public TimeUpdate()
{

	 if (gTimeStats[1] < 59)
 	 {
 	 	gTimeStats[1] ++;
 	 }
	 else
 	 {
  		gTimeStats[1] = 0;
  		gTimeStats[0] = gTimeStats[0] < 23 ? gTimeStats[0] + 1 : 0;
 	 }
 	 new string1[24];
 	 if (gTimeStats[0] < 10)
 	 {
  		if (gTimeStats[1] < 10) format(string1, 12, "0%d:0%d", gTimeStats[0], gTimeStats[1]);
  		else format(string1, 12, "0%d:%d", gTimeStats[0], gTimeStats[1]);
 	 }
	 else
 	 {
  		if (gTimeStats[1] < 10) format(string1, 12, "%d:0%d", gTimeStats[0], gTimeStats[1]);
  		else format(string1, 12, "%d:%d", gTimeStats[0], gTimeStats[1]);
 	 }
 	 for(new i = 0; i < PLAYERS; i++)
	 {
		if(SetVipTime[i] == 0)
		{
	 		 SetPlayerTime(i, gTimeStats[0], gTimeStats[1]);
		}
	 }
 	 TextDrawSetString(Clock, string1);

}
Can someone help me with fixing it? I tried stuff myself but can't fix it.


Re: Time Update - Bolex_ - 22.07.2017

Undefined symbol if(SetVipTime[i] == 0)

The cause may be: You don't have created that define/stock/public , take a look


Re: Time Update - Uvais - 22.07.2017

Код:
CMD:setviptime(playerid, params[])
{
	new hour, minute;
    if(vip[playerid] < 1) return SendClientMessage(playerid, COLOR_WHITE, "Only VIPs can use this command!");
	if(sscanf(params, "dd", hour, minute)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /vtime [hour] [minutes]");
	SetPlayerTime(playerid, hour, minute);
    SetVipTime[playerid] = 1;
	return 1;
}
Runs fine without the define, weird i guess. Can you help me make a define? or show me how it's done.


Re: Time Update - jlalt - 22.07.2017

probably you got SetVipTime not defined yet on public function, simply move the TimeUpdate function codes under after setviptime commands.


Re: Time Update - Bolex_ - 22.07.2017

I suggest you to use this instead https://sampforum.blast.hk/showthread.php?tid=254915


Re: Time Update - Uvais - 22.07.2017

Thanks , i got it fixed by adding this at the top of the gamemode:

new SetVipTime[PLAYERS];