A chat problem (ZCMD) -
xXRealLegitXx - 15.02.2013
Hello fellow SA:MPers! I am having a bit of a problem.
First off, this is just a small problem but some people can't chat on my SA:MP server, it just won't work no matter what. They type it, and I can see it but thats it. It is hosted by vortex. It just doesn't show up in the chat.
The REAL problem:
I recently imported a newbie chat using ZCMD
Код:
CMD:n(playerid, params[])
{
new string[128];
if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, LIGHTBLUE, "Usage: /n(ewbie) [Text]");
format(string, sizeof(string), "(The name doesn't work): %s", params);
SendClientMessageToAll(COLOR_BLUE, string);
return 1;
}
It should come up like
"Niall_Horan: How can I start a car?"
"Colter_Pennington: /v > and select engine on the dialog"
But instead it says
":How can I start a car?"
": /v > and select engine on the dialog"
If anyone could help me, and fix this up, I would REP+ you.
-Jason
Re: A chat problem (ZCMD) -
Neil. - 15.02.2013
This.
pawn Код:
CMD:n(playerid, params[])
{
new string[128], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, LIGHTBLUE, "Usage: /n(ewbie) [Text]");
format(string, sizeof(string), "%s: %s",pName, params);
SendClientMessageToAll(COLOR_BLUE, string);
return 1;
}
Re: A chat problem (ZCMD) -
JJB562 - 15.02.2013
Here's the new code.
pawn Код:
CMD:n(playerid, params[])
{
new string[128], playername[MAX_PLAYER_NAME];
if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, LIGHTBLUE, "Usage: /n(ewbie) [Text]");
GetPlayerName(playerid, playername, sizeof(playername));
//format(string, sizeof(string), "(The name doesn't work): %s", params);
format(string, sizeof(string), "%s: %s", playername, params);
SendClientMessageToAll(COLOR_BLUE, string);
return 1;
}
EDIT: Ken97 beat me to it...
Re: A chat problem (ZCMD) -
xXRealLegitXx - 15.02.2013
Quote:
Originally Posted by Ken97
This.
pawn Код:
CMD:n(playerid, params[]) { new string[128], pName[MAX_PLAYER_NAME]; GetPlayerName(playerid, pName, sizeof(pName)); if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, LIGHTBLUE, "Usage: /n(ewbie) [Text]"); format(string, sizeof(string), "%s: %s",pName, params); SendClientMessageToAll(COLOR_BLUE, string); return 1; }
|
THank you, worked perfectly.
Re: A chat problem (ZCMD) -
xXRealLegitXx - 15.02.2013
Quote:
Originally Posted by JJB562
Here's the new code.
pawn Код:
CMD:n(playerid, params[]) { new string[128], playername[MAX_PLAYER_NAME]; if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, LIGHTBLUE, "Usage: /n(ewbie) [Text]"); GetPlayerName(playerid, playername, sizeof(playername)); //format(string, sizeof(string), "(The name doesn't work): %s", params); format(string, sizeof(string), "%s: %s", playername, params); SendClientMessageToAll(COLOR_BLUE, string); return 1; }
EDIT: Ken97 beat me to it...
|
Lol thanks anyways :P
Re: A chat problem (ZCMD) -
xXRealLegitXx - 15.02.2013
Quote:
Originally Posted by Ken97
This.
pawn Код:
CMD:n(playerid, params[]) { new string[128], pName[MAX_PLAYER_NAME]; GetPlayerName(playerid, pName, sizeof(pName)); if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, LIGHTBLUE, "Usage: /n(ewbie) [Text]"); format(string, sizeof(string), "%s: %s",pName, params); SendClientMessageToAll(COLOR_BLUE, string); return 1; }
|
Could you tell me how to add a timer between messages like
/n Can you help me with /v?
"**Newbie: Niall_Horan: Can you help me with /v?
/n Thanks
"You must wait 30 seconds after your last message to talk in Newbie."
Re: A chat problem (ZCMD) -
Scenario - 15.02.2013
https://sampwiki.blast.hk/wiki/SetTimer
https://sampwiki.blast.hk/wiki/SetTimerEx
OR... you could use y_timers; it's much easier, and much smoother to handle timers with.
Re: A chat problem (ZCMD) -
RajatPawar - 15.02.2013
Make a global MAX_PLAYERS variable, set it as one under OnPlayerText. Then set a timer, to change it's value to 0 after whatever, 30 seconds or watever, and again OnPlayerText, check if the variable is 1, if yes, return 0 with your warning, if not, return 1;