09.05.2010, 11:36
Hello, how can I get this string "00:00:00" into Hours=00 Mins=00 Secs=00 ?
new tmpstrh[254]; tmpstrh = GetSqlUserDataStr(playerid,"onlinetime"); strdel(tmpstrh,3,30); new tmpstrm[254]; tmpstrm = GetSqlUserDataStr(playerid,"onlinetime"); strdel(tmpstrm,0,3); strdel(tmpstrm,6,30); new tmpstrs[254]; tmpstrs = GetSqlUserDataStr(playerid,"onlinetime"); strdel(tmpstrs,6,0);
stock bool:Split(const string[], strdest[][], destsize = sizeof(strdest), separator = 32)
{
new lenght = strlen(string);
new index;
if(!lenght || !destsize || !separator) return false;
for(new i; i<destsize; i++)
{
while(index < lenght && string[index] == separator) index++;
new offset = index;
if(i < destsize - 1) while(index < lenght && string[index] != separator) strdest[i][index - offset] = string[index], index++;
else while(index <= lenght) strdest[i][index - offset] = string[index], index++;
strdest[i][index - offset] = 0;
}
return true;
}
new Time[] = "21:07:35";
new SplitTime[3][2];
Split(Time, SplitTime, sizeof(SplitTime), ':');
for(new i; i<3; i++) if(SplitTime[i][0] == '0') strdel(SplitTime[i], 0, 1);
C:\Users\Robin\Desktop\Robans dm server 0.3\gamemodes\lvdm.pwn(24594) : warning 202: number of arguments does not match definition C:\Users\Robin\Desktop\Robans dm server 0.3\gamemodes\lvdm.pwn(24594) : warning 202: number of arguments does not match definition C:\Users\Robin\Desktop\Robans dm server 0.3\gamemodes\lvdm.pwn(24594) : warning 202: number of arguments does not match definition C:\Users\Robin\Desktop\Robans dm server 0.3\gamemodes\lvdm.pwn(24605) : error 025: function heading differs from prototype C:\Users\Robin\Desktop\Robans dm server 0.3\gamemodes\lvdm.pwn(24605) : error 025: function heading differs from prototype C:\Users\Robin\Desktop\Robans dm server 0.3\gamemodes\lvdm.pwn(24605) : error 025: function heading differs from prototype C:\Users\Robin\Desktop\Robans dm server 0.3\gamemodes\lvdm.pwn(24605) : fatal error 107: too many error messages on one line
TotalOnlineTime(playerid, &h=0, &m=0, &s=0) { new Time[] = "21:07:35"; new SplitTime[3][2]; 24592 Split(Time, SplitTime, sizeof(SplitTime), ':'); for(new i; i<3; i++) if(SplitTime[i][0] == '0') strdel(SplitTime[i], 0, 1); return onlinetime[playerid]; } 24601 stock bool:Split(const string[], strdest[][], destsize = sizeof(strdest), separator = 32) { new lenght = strlen(string); new index; if(!lenght || !destsize || !separator) return false; for(new i; i<destsize; i++) { while(index < lenght && string[index] == separator) index++; new offset = index; if(i < destsize - 1) while(index < lenght && string[index] != separator) strdest[i][index - offset] = string[index], index++; else while(index <= lenght) strdest[i][index - offset] = string[index], index++; strdest[i][index - offset] = 0; } return true; }
C:\Users\Robin\Desktop\Robans dm server 0.3\gamemodes\lvdm.pwn(24592) : warning 202: number of arguments does not match definition C:\Users\Robin\Desktop\Robans dm server 0.3\gamemodes\lvdm.pwn(24592) : warning 202: number of arguments does not match definition C:\Users\Robin\Desktop\Robans dm server 0.3\gamemodes\lvdm.pwn(24592) : warning 202: number of arguments does not match definition C:\Users\Robin\Desktop\Robans dm server 0.3\gamemodes\lvdm.pwn(24601) : error 025: function heading differs from prototype C:\Users\Robin\Desktop\Robans dm server 0.3\gamemodes\lvdm.pwn(24601) : error 025: function heading differs from prototype C:\Users\Robin\Desktop\Robans dm server 0.3\gamemodes\lvdm.pwn(24601) : error 025: function heading differs from prototype C:\Users\Robin\Desktop\Robans dm server 0.3\gamemodes\lvdm.pwn(24601) : fatal error 107: too many error messages on one line