A chat problem (ZCMD)
#1

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
Reply
#2

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;
}
Reply
#3

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...
Reply
#4

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.
Reply
#5

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
Reply
#6

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."
Reply
#7

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.
Reply
#8

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;
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)