PDA

View Full Version : Time Update


Uvais
22/07/2017, 12:01 PM
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 (c) 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.

Bolex_
22/07/2017, 12:06 PM
Undefined symbol if(SetVipTime[i] == 0)

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

Uvais
22/07/2017, 12:11 PM
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.

jlalt
22/07/2017, 12:16 PM
probably you got SetVipTime not defined yet on public function, simply move the TimeUpdate function codes under after setviptime commands.

Bolex_
22/07/2017, 12:16 PM
I suggest you to use this instead http://forum.sa-mp.com/showthread.php?t=254915

Uvais
22/07/2017, 12:19 PM
Thanks , i got it fixed by adding this at the top of the gamemode:

new SetVipTime[PLAYERS];