19.10.2010, 22:05
Quote:
no point.. for a cmd like this..
isnull and zcmd is the fastest way i see it |
Quote:
Again your missing case 1. And random(3) will give 4 cases not 3 (cases 0, 1, 2, 3). If he is comfortable using sscanf there is no problem using that for null checks its not exactly insanely inefficient. Nor is it slow.
|
pawn Код:
// With SSCANF
new Cmdstring[30] = "imastringok?testingsomeshit";
public OnGameModeInit()
{
new Tick = GetTickCount();
new sscanfstring[30];
sscanf(Cmdstring, "s[30]", sscanfstring);
switch(random(3))
{
case 0: { printf("1"); }
case 1: { printf("2"); }
case 2: { printf("3"); }
}
printf("%d", GetTickCount()-Tick);
printf("%s", sscanfstring);
return 1;
}
pawn Код:
// Without SScanf
new Cmdstring[30] = "imastringok?testingsomeshit";
public OnGameModeInit()
{
new Tick = GetTickCount();
switch(random(3))
{
case 0: { printf("1"); }
case 1: { printf("2"); }
case 2: { printf("3"); }
}
printf("%d", GetTickCount()-Tick);
printf("%s", Cmdstring);
return 1;
}
pawn Код:
//SScanf 1-1-0
//W/O SScanf 0-1-1