if(strcmp(cmdtext, "/suggest", true, 5)==0) { new string[128], name[MAX_PLAYER_NAME]; new File:pos = fopen("suggestions.txt", io_append); GetPlayerName(playerid, name, sizeof(name)); if(!strlen(cmdtext)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /suggest <your suggestion>"); format(string, sizeof(string), "%s has suggested: %s ", name, cmdtext[6]); fwrite(pos, string); fwrite(pos, "\r\n"); fclose(pos); SendClientMessage(playerid,COLOR_WHITE,"SERVER: You have done a suggestion!"); return 1; }
if(!strlen(cmdtext)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /suggest <your suggestion>");
if(strlen(cmdtext) < 10) return SendClientMessage(playerid, COLOR_RED, "USAGE: /suggest <your suggestion>");
Originally Posted by lrZ^
change
pawn Код:
pawn Код:
|
if(!strcmp(cmdtext, "/suggest", true, 8)) //"/suggest" is 8 character long
{
if(cmdtext[8] != 32 || cmdtext[9] == EOS)
return SendClientMessage(playerid, COLOR_RED, "USAGE: /suggest <your suggestion>");
SendClientMessage(playerid, COLOR_WHITE, "SERVER: You have done a suggestion!");
//I send the message before so the player dont notices if lag arise within the code
new string[128];
File:pos = fopen("suggestions.txt", io_append);
GetPlayerName(playerid, string, MAX_NAME_LENGTH); //you can use one array for that too because the array gets
format(string, sizeof string, "%s has suggested: %s\r\n", string, cmdtext[9]); //after the function "format" overwriten
fwrite(pos, string), fclose(pos);
return true;
}
Originally Posted by lrZ^
EOS and 32? :P
Explain pls ![]() |
if(!strcmp(cmdtext, "/suggest", true, 8)) //"/suggest" is 8 character long
{
if(cmdtext[8] != 32 || cmdtext[9] == EOS)
return SendClientMessage(playerid, COLOR_RED, "USAGE: /suggest <your suggestion>");
SendClientMessage(playerid, COLOR_WHITE, "SERVER: You have done a suggestion!");
//I send the message before so the player dont notices if lag arise within the code
new string[128], // Here's the fix, there was a ; instead of ,
File:pos = fopen("suggestions.txt", io_append);
GetPlayerName(playerid, string, MAX_NAME_LENGTH); //you can use one array for that too because the array gets
format(string, sizeof string, "%s has suggested: %s\r\n", string, cmdtext[9]); //after the function "format" overwriten
fwrite(pos, string), fclose(pos);
return true;
}