Two good commands - Please help, how can I make them
#1

Hi, I have a question. Does anybody know how to make those two commands? Basicly my server is RPG one, and we have jobs on there. One is truck driver and other a pilot. I would need radio commands for both of jobs and /takeoff and /land commands so pilots can ask ATC for clearance.

So, these are the commands i need:

/cb text - CB Radio, for truckers so it appears (CB Radio: Player says: text)
+text - Global Radio for pilots so it appears (RADIO:PlayerNick@Global: text)
/takeoff - So pilots can takeoff and it sometimes appear You are cleared for takeoff! and You are not cleared for takeoff! Of Course, its gotta be random, and most of the time, I would like the first one to appear
/land - Same as takeoff, but for landing this time. So for e.g You are cleared for landing!

P.S - If /takeoff and /land are impossible, just please leave them out. I want to know script for those first two more, than those two last ones.

Hope someone will help
Regards
Puzi
Reply
#2

this is /cb
pawn Код:
if(strcmp(cmd, "/cb", true) == 0)
{
  if(IsPlayerConnected(playerid))
  {
    new string[128];
    GetPlayerName(playerid, sendername, sizeof(sendername));
    new length = strlen(cmdtext);
    while ((idx < length) && (cmdtext[idx] <= ' '))
    {
      idx++;
    }
    new offset = idx;
    new result[64];
    while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
    {
      result[idx - offset] = cmdtext[idx];
      idx++;
    }
    result[idx - offset] = EOS;
    if(!strlen(result))
    {
      SendClientMessage(playerid, COLOR_COLOR, "USAGE: /cb [radio chat]");
      return 1;
    }
    format(string, sizeof(string), "CB Radio: %s says: %s, sendername, result);
    SendClientMessageToAll(COLOR_COLOR,string);
    printf("
%s", string);
    return 1;
  }
  return 1;
}
And search for /takeoff and /land.
Reply
#3

Thanks very much , does someone know how to do Global Radio? Plz reply
Reply
#4

Код:
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1346) : error 017: undefined symbol "sendername"
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1346) : error 017: undefined symbol "sendername"
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1346) : error 029: invalid expression, assumed zero
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1346) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Can someone help plz? How do I fix this? I copied CB Radio Script above and those errors came up when compiling

Код:
GetPlayerName(playerid, sendername, sizeof(sendername));
That line seems to be wrong
Reply
#5

line is not wrong.
replace this:
pawn Код:
if(strcmp(cmd, "/cb", true) == 0)
{
  if(IsPlayerConnected(playerid))
  {
    new string[128];
With:
pawn Код:
if(strcmp(cmd, "/cb", true) == 0)
{
  if(IsPlayerConnected(playerid))
  {
    new string[128], sendername[MAX_PLAYER_NAME];
Reply
#6

Код:
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1347) : error 017: undefined symbol "idx"
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1349) : error 017: undefined symbol "idx"
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1349) : warning 215: expression has no effect
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1351) : error 017: undefined symbol "idx"
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1353) : error 017: undefined symbol "idx"
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1355) : error 017: undefined symbol "idx"
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1356) : error 017: undefined symbol "idx"
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1356) : warning 215: expression has no effect
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1358) : error 017: undefined symbol "idx"
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1361) : error 017: undefined symbol "COLOR_COLOR"
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1364) : error 037: invalid string (possibly non-terminated string)
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1364) : error 017: undefined symbol "CB"
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1364) : error 029: invalid expression, assumed zero
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1364) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


12 Errors.
That causes more errors :/ Weird...
Reply
#7

pawn Код:
if(strcmp(cmd, "/cb", true) == 0)
{
  if(IsPlayerConnected(playerid))
  {
    new string[128], sendername[MAX_PLAYER_NAME], idx;
    GetPlayerName(playerid, sendername, sizeof(sendername));
    new length = strlen(cmdtext);
    while ((idx < length) && (cmdtext[idx] <= ' '))
    {
      idx++;
    }
    new offset = idx;
    new result[64];
    while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
    {
      result[idx - offset] = cmdtext[idx];
      idx++;
    }
    result[idx - offset] = EOS;
    if(!strlen(result))
    {
      SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /cb [radio chat]");
      return 1;
    }
    format(string, sizeof(string), "CB Radio: %s says: %s", sendername, result);
    SendClientMessageToAll(COLOR_YELLOW,string);
    printf("%s", string);
    return 1;
  }
  return 1;
}
Fixed. NOTE: if you don't have color_yellow in script, replace YELLOW with aother Color name YOU GOT in script.

Edit: should compile now,
Reply
#8

I have again the 4 same errors as above. I'm confused LOL! Anyway, i have COLOR_YELLOW in script, and i think there may be a problem with 'sendername' because it keeps showing sendername errors.
Reply
#9

Edited previous code.
Reply
#10

Works perfect. Thanks very much
Reply
#11

Finally!, yourw elcome.
Reply
#12

Hmm, but when i type /cb text it comes up with SERVER: Unknown command and when I type /cb it comes up with CB Radio: Puzi says: /cb. I'm confused Please help.
Reply
#13

if you only do /cb it should say: SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /cb [radio chat]");
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)