task TimeOnServer[1000]()
{
foreach(Player, i)
{
if(pInfo[i][pLogged] == true)
{
pInfo[i][pSec] ++;
if(pInfo[i][pSec] >= 60)
{
pInfo[i][pMin]++;
pInfo[i][pSec]=0;
}
if(pInfo[i][pMin] >= 60)
{
pInfo[i][pMin]=0;
pInfo[i][pHour]++;
SetPlayerScore(i,pInfo[i][pHour]);
}
}
}
return 1;
}
(419) : error 010: invalid function or declaration
(421) : error 010: invalid function or declaration
(423) : error 010: invalid function or declaration
(426) : error 010: invalid function or declaration
(431) : error 010: invalid function or declaration
(439) : error 010: invalid function or declaration
ptask TimeOnServer[1000](playerid) { if(pInfo[playerid][pLogged]) { pInfo[playerid][pSec]++; if(pInfo[playerid][pSec] == 60) { pInfo[playerid][pSec] = 0; pInfo[playerid][pMin]++; } if(pInfo[playerid][pMin] == 60) { pInfo[playerid][pMin] = 0; pInfo[playerid][pHour]++; SetPlayerScore(playerid,pInfo[playerid][pHour]); } } return 1; }
Код:
ptask TimeOnServer[1000](playerid) { if(pInfo[playerid][pLogged]) { pInfo[playerid][pSec]++; if(pInfo[playerid][pSec] == 60) { pInfo[playerid][pSec] = 0; pInfo[playerid][pMin]++; } if(pInfo[playerid][pMin] == 60) { pInfo[playerid][pMin] = 0; pInfo[playerid][pHour]++; SetPlayerScore(playerid,pInfo[playerid][pHour]); } } return 1; } |
This is poor design overall. You only need to store seconds: 60 seconds in a minute, 3600 seconds in an hour, 86400 seconds in a day, etc. Second point (no pun intended) is that the time on the server can be calculated with either gettime() or NetStats_GetConnectedTime(). This eradicates the need for an expensive timer entirely.
|
(421) : error 017: undefined symbol "playerid" (423) : error 017: undefined symbol "playerid" (424) : error 017: undefined symbol "playerid" (426) : error 017: undefined symbol "playerid" (428) : error 017: undefined symbol "playerid" (430) : error 017: undefined symbol "playerid" (431) : error 017: undefined symbol "playerid" (432) : error 017: undefined symbol "playerid"
Timer:TimeOnServer[1000](playerid)
{
if(pInfo[playerid][pLogged]) /* Line 421 */
{
pInfo[playerid][pSec]++;
if(pInfo[playerid][pSec] == 60)
{
SetPlayerScore(playerid,pInfo[playerid][pSec]);
}
if(pInfo[playerid][pMin] == 60)
{
pInfo[playerid][pMin] = 0;
pInfo[playerid][pHour]++;
SetPlayerScore(playerid,pInfo[playerid][pHour]);
}
}
return 1;
}