Bug with printing a string
#8

Quote:
Originally Posted by Sinner
Посмотреть сообщение
If you're a beginner you might aswel learn the modern techniques from the start instead of using outdated and very inefficient code (strcmp, strtok).

You'll need the following for this:
- sscanf
- zcmd (or equivalent)

pawn Код:
COMMAND:b(playerid, params[]) {
    new text[128];
    if(sscanf(params, "s[128]", text)) return SendClientMessage(playerid, 0xFF0000, "Usage: /b <message>");
   
    new string[128 + MAX_PLAYER_NAME];
    new pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
   
    format(string, sizeof(string), "[OOC]%s: (( %s ))", pname, text);
    ProxDetector(7.0, playerid, string, COLOR_LIGHTGREEN, COLOR_LIGHTGREEN, COLOR_LIGHTGREEN, COLOR_LIGHTGREEN, COLOR_LIGHTGREEN);
    return 1;
}
EDIT:


That's like saying you will only use Assembly and refuse to use Java because it's more evolved. With that attitude you will not (read:never) be able to make good scripts.

Scripting is NOT about copying other people's code and adding your text. I can asume that the script you have uses strcmp -- newsflash! strcmp is outdated so either convert it to a better alternative or stop scripting all together. Asking people to improve on your already horrible code and refusing to take perfectly valid modern techniques as the solution just makes us not want to help you again.
I know that scripting is not about copying other people's code and i do understand that strcmp and strtok are outdated but that's how i learned how to script to where i am. And also i couldn't be bothered converting 7,000 lines of code into zcmd and sscanf that's like starting over for me at 0.
Reply


Messages In This Thread
Bug with printing a string - by ChrisMorasco - 08.06.2013, 12:34
Re: Bug with printing a string - by Vince - 08.06.2013, 12:42
Re: Bug with printing a string - by ChrisMorasco - 08.06.2013, 12:53
Re: Bug with printing a string - by Vince - 08.06.2013, 13:15
Re: Bug with printing a string - by ChrisMorasco - 09.06.2013, 10:37
Re: Bug with printing a string - by Sinner - 09.06.2013, 10:46
delete - by Omirrow - 09.06.2013, 12:31
Re: Bug with printing a string - by ChrisMorasco - 09.06.2013, 13:20
Re: Bug with printing a string - by Sinner - 09.06.2013, 14:42
Re: Bug with printing a string - by ChrisMorasco - 09.06.2013, 15:13

Forum Jump:


Users browsing this thread: 1 Guest(s)