How can I make a 10- code -
grand.Theft.Otto - 06.03.2011
You might have played CrazyBob's CnR and notice he has 10- codes like for example: Okay, affirmative (10-4), Good Job! (10-120)
I was wondering how do I make them? At the moment I have this code:
pawn Код:
if (strfind(text, "10-0") != -1) // THIS FINDS THE TEXT THAT THE PLAYER TYPES IN THE CHAT
{
new PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
format(text, 1024, "%s (%d): {FFFFFF}Testing (10-0)", PlayerName, playerid, text); // THIS LINE SHOWS A CUSTOM NAME OF THE 10 CODE WHICH IS Testing (10-0) - This is what I want it to show up as when someone types 10-0 in the chat
SendClientMessageToAll(GetPlayerColor(playerid), text);
//SCROLL RIGHT -----> TO SEE THE REST
}
So in easier terms, when someone types 10-0 in the chat it will say Testing (10-0). I tried this above code but it didn';t work and it still showed up as 10-0 when someone typed it.
Thanks.
Re: How can I make a 10- code -
Sascha - 06.03.2011
pawn Код:
public OnPlayerText(playerid, text[])
{
if(!strcmp(text, "10-0", true))
{
new string[100], PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
format(text, 1024, "%s (%d): {FFFFFF}Testing (10-0)", PlayerName, playerid, text); // THIS LINE SHOWS A CUSTOM NAME OF THE 10 CODE WHICH IS Testing (10-0) - This is what I want it to show up as when someone types 10-0 in the chat
SendClientMessageToAll(GetPlayerColor(playerid), text);
return 0;
}
return 1;
}
try this
Re: How can I make a 10- code -
grand.Theft.Otto - 06.03.2011
That does not work. Thanks though.
Anyone else?
Re: How can I make a 10- code -
Sascha - 06.03.2011
pawn Код:
public OnPlayerText(playerid, text[])
{
if(!strcmp(text, "10-0", true))
{
new string[100], PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
format(string, sizeof(string), "%s (%d): {FFFFFF}Testing (10-0)", PlayerName, playerid); // THIS LINE SHOWS A CUSTOM NAME OF THE 10 CODE WHICH IS Testing (10-0) - This is what I want it to show up as when someone types 10-0 in the chat
SendClientMessageToAll(GetPlayerColor(playerid), text);
return 0;
}
return 1;
}
try now
Re: How can I make a 10- code -
maramizo - 06.03.2011
pawn Код:
CMD:10-0(playerid, params[])
{
new string[128], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
format(string, 128, "%s: Testing (10-0)", name);
SendClientMessageToAll(GetPlayerColor(playerid), string);
return 1;
}
Sorry for indenting, made it in browser.
Re: How can I make a 10- code -
maramizo - 06.03.2011
Quote:
Originally Posted by Sascha
pawn Код:
public OnPlayerText(playerid, text[]) { if(!strcmp(text, "10-0", true)) { new string[100], PlayerName[MAX_PLAYER_NAME]; GetPlayerName(playerid, PlayerName, sizeof(PlayerName)); format(string, sizeof(string), "%s (%d): {FFFFFF}Testing (10-0)", PlayerName, playerid); // THIS LINE SHOWS A CUSTOM NAME OF THE 10 CODE WHICH IS Testing (10-0) - This is what I want it to show up as when someone types 10-0 in the chat SendClientMessageToAll(GetPlayerColor(playerid), text); return 0; } return 1; }
try now
|
Are you a newb? it's OnPlayerCommandText.
Re: How can I make a 10- code -
Lorrden - 06.03.2011
OnPlayerText, use sscanf to check wheather or not the player entered "10-" followed by a number.
Re: How can I make a 10- code -
Sascha - 06.03.2011
Quote:
Originally Posted by maramizo
Are you a newb? it's OnPlayerCommandText.
|
cough lol..
it more seems as if you are a "newb"...
look..
OnPlayerCommandText detects commands... it would be: /10-0
my version detects the text that is written into the chat so:
10-0
instead of showing 10-0 it should show the msg...
Re: How can I make a 10- code -
Lorrden - 06.03.2011
Quote:
Originally Posted by Sascha
cough lol..
OnPlayerCommandText detects commands... it would be: /10-0
my version detects the text that is written into the chat so:
10-0
instead of showing 10-0 it should show the msg...
|
I agree, but he should use sscanf instead of strfind or strcmp
Re: How can I make a 10- code -
grand.Theft.Otto - 06.03.2011
Quote:
Originally Posted by Lorrden
I agree, but he should use sscanf instead of strfind or strcmp 
|

Could you please make one, I don't know how to set it up, I use sscanf but I just don't know how to setup the code.
Also, sascha and maram, both don't work