06.10.2010, 16:13
This is horrible code.
1. you are comparing the first 9 characters of a string that is 14 characters long
2. you have defined a string 256 characters long to hold a string that you don't even use
3. the string you are displaying the result in is only 128 characters long, and you don't even need it anyway
4. if you are using strtok, idx should already be defined under OnPlayerCommandText
5. idx should already have a value from when you used strtok to get the /advertissment command
1. you are comparing the first 9 characters of a string that is 14 characters long
2. you have defined a string 256 characters long to hold a string that you don't even use
3. the string you are displaying the result in is only 128 characters long, and you don't even need it anyway
4. if you are using strtok, idx should already be defined under OnPlayerCommandText
5. idx should already have a value from when you used strtok to get the /advertissment command
pawn Код:
public OnPlayerCOmmandText(playerid,cmdtext[])
{
new tmp[128],idx;
tmp = strtok(cmdtext, idx);
if(!strcmp(tmp,"/advertissment",true))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
//message
}
AdvertissmentForward(tmp);
}
return 0;
}