if (strcmp("/breakout", cmdtext, true, 5) == 0) { if (gTeam[playerid] == TEAM_BALLA) { if(IsPlayerInRangeOfPoint(playerid, 2.0, 234.8687,1118.6041,1084.9922)) SetPlayerPos(playerid,2482.2227,-1646.2852,18.3521); SetPlayerInterior(playerid,0); } } else { SendClientMessage(playerid, COLOR_WHITE,"You are not in /breakout checkpoint"); return 0; } return 0;
if (!strcmp("/breakout", cmdtext) )
if(!strcmp("/breakout", cmdtext) )
{
if(!IsPlayerInRangeOfPoint(playerid, 2.0, 234.8687,1118.6041,1084.9922))return SendClientMessage(playerid, COLOR_WHITE,"You are not in /breakout checkpoint");
if (gTeam[playerid] == TEAM_BALLA)
{
SetPlayerPos(playerid,2482.2227,-1646.2852,18.3521);
SetPlayerInterior(playerid,0);
return 1;
}
if(gTeam[playerid] == OTHER_TEAM)
{
//other stuff for other teams
}
}
if (!strcmp("/breakout", cmdtext, true, 5) == 0)
{
if (gTeam[playerid] == TEAM_BALLA)
{
if(IsPlayerInRangeOfPoint(playerid, 2.0, 234.8687,1118.6041,1084.9922))
SetPlayerPos(playerid,2482.2227,-1646.2852,18.3521);
SetPlayerInterior(playerid,0);
}
}
else
{
SendClientMessage(playerid, COLOR_WHITE,"You are not in /breakout checkpoint");
return 1;
}
return 0;
}
I have a script like this. I want that when i write /breakout and im not on *IsPlayerInRangeOfPoint* it should write *You are not in /breakout checkpoint*, but it doesnt. I guess i missed a bracket or something.
Код:
if (strcmp("/breakout", cmdtext, true, 5) == 0) { if (gTeam[playerid] == TEAM_BALLA) { if(IsPlayerInRangeOfPoint(playerid, 2.0, 234.8687,1118.6041,1084.9922)) SetPlayerPos(playerid,2482.2227,-1646.2852,18.3521); SetPlayerInterior(playerid,0); } } else { SendClientMessage(playerid, COLOR_WHITE,"You are not in /breakout checkpoint"); return 0; } return 0; What is (srtcmp ,cmdtext, true, 5) == 0) |
if (strcmp("/breakout", cmdtext, true, 5) == 0)
{
if (gTeam[playerid] == TEAM_BALLA)
{
if(IsPlayerInRangeOfPoint(playerid, 2.0, 234.8687,1118.6041,1084.9922))
{
SetPlayerPos(playerid,2482.2227,-1646.2852,18.3521);
SetPlayerInterior(playerid,0);
}
}
else
{
SendClientMessage(playerid, COLOR_WHITE,"You are not in /breakout checkpoint");
}
return 1;
}
pawn Код:
The strcmp thing: strcmp compares two "strings" to see if they are the same. if (strcmp("/breakout", cmdtext, true, 5) == 0) If "/breakout" is the same as cmdtext(what was typed by the player), then execute the command. "true" is wether or not to check for upper/lower case letters. If it is "false", "Hello" and "hEllo" are not the same. If it's true, they are the same. |
(!strcmp("/breakout", cmdtext, true, 5) == 0)
its (!strcmp("/breakout", cmdtext, true, 5) == 0) the '!' is very important.
|
its
pawn Код:
|
(!strcmp("/breakout", cmdtext, true, 5))
(strcmp("/breakout", cmdtext, true, 5) == 0)
(!strcmp("/breakout", cmdtext, true, 9)) //dno if null counts, if so it's 10, not 9
if( !strcmp( cmdtext, "/breakout", true ))
{
if( gTeam[playerid] != TEAM_BALLA )
return 0;
if( !IsPlayerInRangeOfPoint( playerid, 2.0, 234.8687, 1118.6041, 1084.9922 ))
return 0;
SetPlayerPos(playerid,2482.2227,-1646.2852,18.3521);
SetPlayerInterior(playerid,0);
return 1;
}
Originally Posted by LarzI
What the hell are you doing?
First of all, when you ! is the same as "is false", aka. is equal to 0 |
Originally Posted by LarzI
Second of all, "/breakout" isn't only 5 characters. Either remove "5" or change it to the correct value:
|
use
pawn Код:
pawn Код:
|