12.09.2010, 09:55
(
Последний раз редактировалось CrucixTM; 12.09.2010 в 11:08.
)
Quote:
|
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) |
pawn Код:
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;
}
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.


