Quote:
Originally Posted by linuxthefish
How can i change strtok into sscanf? I cant find a good tutorial on it.
|
Ehm here's a small, little command, used with dcmd. It's an /me command.
pawn Код:
dcmd_me(playerid, params[])
{
new Action[100]; //Used for the param. Important!
new str[128], pName[MAX_PLAYER_NAME];
if(sscanf(params, "s", action)) return 0; //No param used.
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
format(str, 128, "%s %s", pName, Action);
SendClientMessageToAll(0xFFFFFFAA, str);
return 1;
}
When you use 'if(sscanf' stuff, it will show you when there is NO param filled in. The 's' is the string. It's the same with formatting: '%s'. So 'd', 'i' or 'u' etc are integers. 'f' is a float. Get it? And after that, use the strings you want to use.
if(sscanf(params, "ds", giveplayerid, reason)).
This is mostly used for ban/kick commands. the 'd' is an integer and the 's' is the string. Behind that, use the strings you wanna use in the script.
Sorry if I am unclear. I hope that you understand this