How to get 00:00:00 into Hours=00 Mins=00 Secs=00 ? -
robanswe - 09.05.2010
Hello, how can I get this string "00:00:00" into Hours=00 Mins=00 Secs=00 ?
Re: How to get 00:00:00 into Hours=00 Mins=00 Secs=00 ? -
iJumbo - 09.05.2010
you need a command set a time ?
Re: How to get 00:00:00 into Hours=00 Mins=00 Secs=00 ? -
robanswe - 09.05.2010
No I have information about total online time in a string like "00:00:00" and I wont to insert that information into 3 varibles like Hours = 00 Mins = 00 and Secs = 00.. How to do that?
Re: How to get 00:00:00 into Hours=00 Mins=00 Secs=00 ? -
iJumbo - 09.05.2010
yo uahve a script ? can you show?
Re: How to get 00:00:00 into Hours=00 Mins=00 Secs=00 ? -
robanswe - 09.05.2010
This is all I got...
Код:
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);
Re: How to get 00:00:00 into Hours=00 Mins=00 Secs=00 ? -
¤Adas¤ - 09.05.2010
Use this:
pawn Код:
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;
}
How?
pawn Код:
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);
Now you have values in variable "SplitTime". You can get them using strval.
Re: How to get 00:00:00 into Hours=00 Mins=00 Secs=00 ? -
robanswe - 09.05.2010
I'm getting this error when using your code:
Код:
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
Re: How to get 00:00:00 into Hours=00 Mins=00 Secs=00 ? -
¤Adas¤ - 09.05.2010
Oh, show me the lines
Re: How to get 00:00:00 into Hours=00 Mins=00 Secs=00 ? -
robanswe - 09.05.2010
This is just an fast test to see if I got any errors with your code..
Код:
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
Re: How to get 00:00:00 into Hours=00 Mins=00 Secs=00 ? -
¤Adas¤ - 09.05.2010
Maybe you have to put stock above the code