Help OnPlayerCommandText
#1

Hello again, I made a "FS" For a race and I want that when someone types one command it says to all players "An admin bla bla bla"

The code is below, But when I try to compile

Код:
C:\Users\Daniel\Desktop\Pity's Cops&Robbers\filterscripts\UnratedV2.pwn(230) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
CODE BELOW

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp(cmdtext, "/xstart", true)==0)
    {
    MoveObject(start1,1020.647522, -3456.813721, 4.056215, 9.0);
    MoveObject(start2,1020.577087, -3431.305664, 4.135345, 9.0);
    return 1;
    }
    if (strcmp(cmdtext, "/xready", true)==0)
    {
    MoveObject(start1,1020.647522, -3456.813721, 7.056215, 9.0);
    MoveObject(start2,1020.577087, -3431.305664, 7.135345, 9.0);
    return 1;
    }
    if (strcmp(cmdtext, "/xfinish", true)==0)
    {
    MoveObject(finish,960.985779, -3454.437988, 10.569048, 9.0);
    return 1;
    }
    if (strcmp(cmdtext, "/xover", true)==0)
    {
    MoveObject(finish,960.985779, -3454.437988, 1.569048, 9.0);
    return 1;
    }
    if (strcmp(cmdtext, "/xopen", true)==0)
    {
    MoveObject(gate1,1045.418701,-3391.734131,10.071722, 9.0);
    MoveObject(gate2,1045.418701,-3391.734131,10.071722, 9.0);
    MoveObject(gate3,1045.418701,-3391.734131,10.071722, 9.0);
    return 1;
    }
    if (strcmp(cmdtext, "/xclose", true)==0)
    {
    MoveObject(gate1,1016.925171, -3391.767578, 10.071722, 9.0);
    MoveObject(gate2,1026.129395, -3391.770752, 10.096722, 9.0);
    MoveObject(gate3,1035.418701, -3391.734131, 10.071722, 9.0);
    return 1;
    }
    if(strcmp(cmdtext, "/race1", true) == 0)
    {
    SetPlayerPos(playerid, 977.9678,-3380.5745,4.7747);
    SendClientMessage(playerid, red, "SERVER: You have entered Unrated's Formula 1 Race Track");
    SendClientMessage(playerid, orange, "SERVER: Please wait for a server admin to host the race!!");
    SendClientMessage(playerid, orange, "SERVER: If there's not any server admin on (/admins) do not race, If theres no admins on!!!");
    SendClientMessage(playerid, black, "SERVER: It is forbidden to Rob / Rape / Kill someone on this map!");
    SendClientMessage(playerid, blue, "SERVER: If you kill / rape / rob someone in this area you will be ajailed and warned!");
    SendClientMessage(playerid, LIGHTBLUE, "SERVER: This map was made to have fun, Please grab a car and wait until an admin gives the go signal!");
    return 1;
    }
    if (strcmp(cmdtext, "/xstart", true) ==0)
    {
    //Start Race.
    SendClientMessageToAll(red, "An admin has gaven the siganl to GO, START RACING!!!!!!.");
    return 1;
    }
    if (strcmp(cmdtext, "/xready", true) ==0)
    {
    //Get Ready
    SendClientMessageToAll(red, "An admin has gaven the signal to get READY, Please get in your car and wait for the go signal");
    return 1;
	  }
    if (strcmp(cmdtext, "/xfinish", true) ==0)
    {
    //End race.
    SendClientMessageToAll(red, "The race was ended! In shortly the Admin will give the results!! Congratulations to all racers.");
    return 1;
    }
    if (strcmp(cmdtext, "/xover", true) ==0)
    {
    //Race over
    SendClientMessageToAll(red, "An admin has ended the race for some motive, He will announce in some moments the reason");
    return 1;
    }
    if (strcmp(cmdtext, "/xopen", true) ==0)
    {
    //Open gate
    SendClientMessageToAll(red, "An admin has open the Car hangar, Grab a car and wait for the admin to give the instructions");
    return 1;
    }
    if (strcmp(cmdtext, "/xclose", true) ==0)
    {
    //Close gate
    SendClientMessageToAll(red, "An admin has closed the Car hangar, The admin will announce in some moments the race start");
    return 1;
    }
  return 0;
}

Reply
#2

Indent your code. If you don't know what I mean, then check the pawn-lang.pdf file (you can find it on ******).
Reply
#3

I ****** that and this comes out

http://code.******.com/p/pawnscript/...pec=svn33&r=33

Sorry, But I'm not a pro Scripter, Can you explain more detailed?
Reply
#4

Here's an indented code (just an example):
pawn Код:
myFunction(myVar1, myVar2)
{
  new
      myVar3, myVar4, myValue;
  myVar3 = myVar1;
  myVar4 = myVar2;
  myValue = myVar3 + myVar4;
  if(myValue == 0)
  {
    myValue = 5;
  }
  return myValue;
}
And here's a code which isn't indented (just an example):
pawn Код:
myFunction(myVar1, myVar2)
{
new
      myVar3, myVar4, myValue;
  myVar3 = myVar1;
myVar4 = myVar2;
    myValue = myVar3 + myVar4;
  if(myValue == 0)
  {
myValue = 5;
    }
return myValue;
}
Reply
#5

I kinda understand, But might you help me making it in my codet?

Please, I'm not that kinda advanced script.
Reply
#6

pawn Код:
}
  return 0;
}
just look into it and put it correctly.

it should be
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp(cmdtext, "/xstart", true)==0)
    {
    MoveObject(start1,1020.647522, -3456.813721, 4.056215, 9.0);
    MoveObject(start2,1020.577087, -3431.305664, 4.135345, 9.0);
    return 1;
    }
    if (strcmp(cmdtext, "/xready", true)==0)
    {
    MoveObject(start1,1020.647522, -3456.813721, 7.056215, 9.0);
    MoveObject(start2,1020.577087, -3431.305664, 7.135345, 9.0);
    return 1;
    }
    if (strcmp(cmdtext, "/xfinish", true)==0)
    {
    MoveObject(finish,960.985779, -3454.437988, 10.569048, 9.0);
    return 1;
    }
    if (strcmp(cmdtext, "/xover", true)==0)
    {
    MoveObject(finish,960.985779, -3454.437988, 1.569048, 9.0);
    return 1;
    }
    if (strcmp(cmdtext, "/xopen", true)==0)
    {
    MoveObject(gate1,1045.418701,-3391.734131,10.071722, 9.0);
    MoveObject(gate2,1045.418701,-3391.734131,10.071722, 9.0);
    MoveObject(gate3,1045.418701,-3391.734131,10.071722, 9.0);
    return 1;
    }
    if (strcmp(cmdtext, "/xclose", true)==0)
    {
    MoveObject(gate1,1016.925171, -3391.767578, 10.071722, 9.0);
    MoveObject(gate2,1026.129395, -3391.770752, 10.096722, 9.0);
    MoveObject(gate3,1035.418701, -3391.734131, 10.071722, 9.0);
    return 1;
    }
    if(strcmp(cmdtext, "/race1", true) == 0)
    {
    SetPlayerPos(playerid, 977.9678,-3380.5745,4.7747);
    SendClientMessage(playerid, red, "SERVER: You have entered Unrated's Formula 1 Race Track");
    SendClientMessage(playerid, orange, "SERVER: Please wait for a server admin to host the race!!");
    SendClientMessage(playerid, orange, "SERVER: If there's not any server admin on (/admins) do not race, If theres no admins on!!!");
    SendClientMessage(playerid, black, "SERVER: It is forbidden to Rob / Rape / Kill someone on this map!");
    SendClientMessage(playerid, blue, "SERVER: If you kill / rape / rob someone in this area you will be ajailed and warned!");
    SendClientMessage(playerid, LIGHTBLUE, "SERVER: This map was made to have fun, Please grab a car and wait until an admin gives the go signal!");
    return 1;
    }
    if (strcmp(cmdtext, "/xstart", true) ==0)
    {
    //Start Race.
    SendClientMessageToAll(red, "An admin has gaven the siganl to GO, START RACING!!!!!!.");
    return 1;
    }
    if (strcmp(cmdtext, "/xready", true) ==0)
    {
    //Get Ready
    SendClientMessageToAll(red, "An admin has gaven the signal to get READY, Please get in your car and wait for the go signal");
    return 1;
      }
    if (strcmp(cmdtext, "/xfinish", true) ==0)
    {
    //End race.
    SendClientMessageToAll(red, "The race was ended! In shortly the Admin will give the results!! Congratulations to all racers.");
    return 1;
    }
    if (strcmp(cmdtext, "/xover", true) ==0)
    {
    //Race over
    SendClientMessageToAll(red, "An admin has ended the race for some motive, He will announce in some moments the reason");
    return 1;
    }
    if (strcmp(cmdtext, "/xopen", true) ==0)
    {
    //Open gate
    SendClientMessageToAll(red, "An admin has open the Car hangar, Grab a car and wait for the admin to give the instructions");
    return 1;
    }
    if (strcmp(cmdtext, "/xclose", true) ==0)
    {
    //Close gate
    SendClientMessageToAll(red, "An admin has closed the Car hangar, The admin will announce in some moments the race start");
    return 1;
    }
    return 0;
}
Reply
#7

Press TAB on your keyboard to indent your code.
Reply
#8

i didnt correct every } etc but it should work like i said.
Reply
#9

THANK YOU SO MUCH RUSOOOOOOOOOOOOOOOOOO !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! THANKS OTHER FOR HELP (DON CORELLI)
Reply
#10

Sorry for double post, But when I type any command it just does the action, It does not shows up the message to me / all players.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)