Wheres the loose identations on my code? -
phil_lendon - 08.09.2012
Wheres the loose indentations?
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/me", cmdtext, true, 10) == 0)
{
if(!cmdtext[3])return SendClientMessage(playerid, 0xFF0000FF, "Correct usage: /me [action]"); // If the player just types /me and no action.
new str[128]; // String
GetPlayerName(playerid, str, sizeof(str)); // Gets the player name for /me
format(str, sizeof(str), "* %s %s", str, cmdtext[4]); // What it's going to look like.
SendClientMessageToAll(0xFFFF00AA, str); // Color to send the message to everyone in.
return 1;
}
return 0;
}
Re: Wheres the loose identations on my code? - Glint - 08.09.2012
I am bad with strcmp but try this :
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/me", cmdtext, true, 10) == 0)
{
if(!cmdtext[3])return SendClientMessage(playerid, 0xFF0000FF, "Correct usage: /me [action]"); // If the player just types /me and no action.
{
new str[128]; // String
GetPlayerName(playerid, str, sizeof(str)); // Gets the player name for /me
format(str, sizeof(str), "* %s %s", str, cmdtext[4]); // What it's going to look like.
SendClientMessageToAll(0xFFFF00AA, str); // Color to send the message to everyone in.
}
}
return 1;
}
return 0;
}
Or on top of your script you can put :
to hide the warning the compiler shows about loose indentation.
Re: Wheres the loose identations on my code? -
nmader - 08.09.2012
For strcmp it is actually this:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/me", cmdtext, true, 10) == 0)
{
if(!cmdtext[3])return SendClientMessage(playerid, 0xFF0000FF, "Correct usage: /me [action]"); // If the player just types /me and no action.
{
new str[128]; // String
GetPlayerName(playerid, str, sizeof(str)); // Gets the player name for /me
format(str, sizeof(str), "* %s %s", str, cmdtext[4]); // What it's going to look like.
SendClientMessageToAll(0xFFFF00AA, str); // Color to send the message to everyone in.
}
return 1;
}
return 0;
}
Also, pretty sure you had the format messed up, so I fixed that to.
Re: Wheres the loose identations on my code? -
detter - 08.09.2012
It should look like this
Код:
SomeFunction()
{
new string[40];
SendClinetMessage(playerid ,COLOR ,"Just a random code...");
if( A == B )
{
SetPlayerPos(playerid ,1 ,2 ,3);
SetPlayerHealth(playerid ,100);
}
}
look very closely at the code and spacing
after this { everything should be spaced same
Re: Wheres the loose identations on my code? -
sniperwars - 08.09.2012
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/me", cmdtext, true, 3) == 0) //It's not 10, it's 3 including the / in the command.
{
if(!cmdtext[3])return SendClientMessage(playerid, 0xFF0000FF, "Correct usage: /me [action]"); // If the player just types /me and no action.
{
new str[128]; // String
GetPlayerName(playerid, str, sizeof(str)); // Gets the player name for /me
format(str, sizeof(str), "* %s %s", str, cmdtext[4]); // What it's going to look like.
SendClientMessageToAll(0xFFFF00AA, str); // Color to send the message to everyone in.
}
return 1;
}
return 0;
}