new startpos = strfind("@Kalcor#2006","@");
if(startpos==-1) SendClientMessage(playerid,-1,"@ not found");
new endpos = strfind("@Kalcor#2006","#");
if(endpos==-1) SendClientMessage(playerid,-1,"# not found");
new string[64];
new discriminator[16];
strmid(string,"@Kalcor#2006",startpos,endpos);
strmid(discriminator,"@Kalcor#2006",endpos,strlen("@Kalcor#2006"));
|
Is that you were looking for?
Код:
new startpos = strfind("@Kalcor#2006","@");
if(startpos==-1) SendClientMessage(playerid,-1,"@ not found");
new endpos = strfind("@Kalcor#2006","#");
if(endpos==-1) SendClientMessage(playerid,-1,"# not found");
new string[64];
new discriminator[16];
strmid(string,"@Kalcor#2006",startpos,endpos);
strmid(discriminator,"@Kalcor#2006",endpos,strlen("@Kalcor#2006"));
|
new name[]="@Kalcor#2006",updated_name[10];
sscanf(name,"P<@#>{s[10]}s[10]{s[10]}",updated_name);
|
using sscanf....
PHP код:
|
|
Is that you were looking for?
Код:
new startpos = strfind("@Kalcor#2006","@");
if(startpos==-1) SendClientMessage(playerid,-1,"@ not found");
new endpos = strfind("@Kalcor#2006","#");
if(endpos==-1) SendClientMessage(playerid,-1,"# not found");
new string[64];
new discriminator[16];
strmid(string,"@Kalcor#2006",startpos,endpos);
strmid(discriminator,"@Kalcor#2006",endpos,strlen("@Kalcor#2006"));
|
|
Thanks @Sys for your help
This one is great but thats not what i mean 60% it spllits those symbols and then adds then in the same variable (i need each one on an variable as @poll97 did using strmid) but anyway thanks alot sir |
new name[]="@Kalcor#2006",updated_name[10],discriminator[10];
sscanf(name,"P<@#>{s[10]}s[10]s[10]",updated_name,discriminator);
|
Thanks @Sys for your help
This one is great but thats not what i mean 60% it spllits those symbols and then adds then in the same variable (i need each one on an variable as @poll97 did using strmid) but anyway thanks alot sir |
new input_string[] = "@TestName#848913";
new username[64];
new discriminator;
new len = strlen(input_string);
for(new i = len; i--; )
{
if(input_string[i] == '#')
{
input_string[i] = ' ';
break;
}
}
if(!sscanf(input_string, "'@'s[64]d", username,discriminator))
{
//do something with username and discriminator
printf("Username: %s | Discriminator: %d ", username, discriminator);
}
Username: TestName | Discriminator: 848913
|
You could so something like this:
PHP код:
Код:
Username: TestName | Discriminator: 848913 |
|
strmid should extract from start+1 on first and endpos+1 in second to get string without "@" or "#"
your code now provides @Kalcor and #2006 if you want the discriminator just unquiet the third specifier PHP код:
|
|
You could so something like this:
PHP код:
Код:
Username: TestName | Discriminator: 848913 |