Gang chat
#1

Код:
	if(strcmp(cmd, "/g", true) == 0)
 {
			strmid(gangChat,text,1,strlen(text));

			GetPlayerName(playerid, senderName, sizeof(senderName));
			format(string, sizeof(string),"[BANDA %s:] %s", senderName, gangChat);

			for(new i = 0; i < gangInfo[playerGang[playerid]][1]; i++) {
				SendClientMessage(gangMembers[playerGang[playerid]][i], COLOR_LIGHTBLUE, string);
			}
	return 1;
}
error 017: undefined symbol "text"


Please help...
Reply
#2

That would fit if you used OnPlayerText callback. Since you use OnPlayerCommandText for that, you need to replace text with the params after the space in "/g (from here to the end)". strtok or split function will work but the whole thing is too inefficient method (old and slow). It'd be better to use ZCMD with isnull and you're done!
Reply
#3

EDIT: Read what Kon said :P
Reply
#4

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
That would fit if you used OnPlayerText callback. Since you use OnPlayerCommandText for that, you need to replace text with the params after the space in "/g (from here to the end)". strtok or split function will work but the whole thing is too inefficient method (old and slow). It'd be better to use ZCMD with isnull and you're done!
Can u addition the code for me?
Reply
#5

To be honest, I'm not sure if cmdtext has stored the parameters too. By using sscanf:
pawn Код:
if(strcmp(cmd, "/g", true) == 0)
{
    new msg[128];
    if(sscanf(cmdtext, "s[128]", msg)) return SendClientMessage(playerid, -1, "Usage: /g <message>");
   
    strmid(gangChat,msg,1,strlen(msg));

    GetPlayerName(playerid, senderName, sizeof(senderName));
    format(string, sizeof(string),"[BANDA %s:] %s", senderName, gangChat);

    for(new i = 0; i < gangInfo[playerGang[playerid]][1]; i++)
    {
        SendClientMessage(gangMembers[playerGang[playerid]][i], COLOR_LIGHTBLUE, string);
    }
    return 1;
}
Reply
#6

thank you very very much, its work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)