24.02.2015, 14:59
Код:
format(str,sizeof(str),"%d\t%s\n", GetPlayerScore(playerid),GetPlayerName(playerid));
Код:
strfind("\\ here, how do I get %d? If i wrote just %d it dont work"));
format(str,sizeof(str),"%d\t%s\n", GetPlayerScore(playerid),GetPlayerName(playerid));
strfind("\\ here, how do I get %d? If i wrote just %d it dont work"));
format(str,sizeof(str),"(%d)\t%s\n", GetPlayerScore(playerid),GetPlayerName(playerid)); //getting the number new g[8]; strmid(g, inputtext, 1, strfind(inputtext, ")")); printf("score: %d", strval(g));
You can use some characters to know where this score is, example
Код:
format(str,sizeof(str),"(%d)\t%s\n", GetPlayerScore(playerid),GetPlayerName(playerid)); //getting the number new g[8]; strmid(g, inputtext, 1, strfind(inputtext, ")")); printf("score: %d", strval(g)); |
In your case you need to find \t and cut out everything in front (thats the score). Than just use strval on that cut out string and you will get value as integer.
|
public OnGameModeInit() { new s[25] = "(28)\tball\n", g[8]; strmid(g, s, 1, strfind(s, ")")); printf("score: %d", strval(g)); return 1; }
strmid(ppl, inputtext, 1, strfind(inputtext, ")"));