Is this correct? CB does not work - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Is this correct? CB does not work (
/showthread.php?tid=115074)
Is this correct? CB does not work -
Puzi - 22.12.2009
Hello there, I made a custom command for a CB Radio. How can I make it available for only certain vehicle ID's, such as Roadtrain and Linerunner?
And why does it come up with SERVER: Unknown command when I do /cb message? When I type /cb, it works, it comes up, but no /cb [text]
Help would be appreciated, here is the code:
Код:
if(!strcmp(cmdtext, "/cb", true, 4)) // 3 is the length of /cb
{
if(!cmdtext[3]) return SendClientMessage(playerid, COLOR_GREY, "UŻYCIE: /cb [wiadomosc]");
new string[128], name[16];
GetPlayerName(playerid, name, sizeof(name));
format(string, 128, "*** CB RADIO ~~ %s mуwi: %s", name, cmdtext[4]);
SendClientMessageToAll(FIOLETOWY, string);
return 1;
}
Thanks and Regards
Puzi
Re: Is this correct? CB does not work -
[HiC]TheKiller - 22.12.2009
Use a command processor like DCMD.
Re: Is this correct? CB does not work -
Puzi - 22.12.2009
All of my commands are in this format, Im worried that it may affect other commands.
And commands such as /me and /og run on the same basis and they work
Re: Is this correct? CB does not work -
DiDok - 22.12.2009
Use strmid function...
Part of my CB script:
Код:
else if(strcmp(cmd,"/cb",true)==0)
{
new pName[MAX_PLAYER_NAME], message[128];
new tmp[256];
strmid(tmp, cmdtext, 4, strlen(cmdtext));
if(!strlen(tmp))
{
SendClientMessage(playerid,COLOR_GREY,"USAGE: /cb [text], change channel with /channel [channel]");
return 1;
}
GetPlayerName(playerid,pName,sizeof(pName));
format(message,sizeof(message),"CB[%d] %s: %s",CBCanal[playerid],pName,tmp);
use it to figure out how to make it.