if(!strcmp(cmdtext, "/do", true, strlen("/do")))
{
new len = strlen("/do");
if (!strlen(cmdtext[len+1])) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /do [Situation]");
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof name);
format(cmdtext, 128, "* %s ( %s ) ", cmdtext[len+1], name );
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
for(new i, m = GetMaxPlayers(); i < m; i++) if (IsPlayerConnected(i))
{
if (IsPlayerInRangeOfPoint(i, 15.0, x, y, z)) SendClientMessage(i, COLOR_PURPLE, cmdtext);
}
return 1;
}
new cmd[256];
if(strcmp(cmd, "/clothes", true) == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 15.0, 161.37, -96.61, 1001.80))
{
new idx;
new tmp[256];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /clothes [Skin ID]");
return 1;
}
new level;
level = strval(tmp);
SetPlayerSkin(playerid, level);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_RED, "You are not in clothing shop !");
}
}
if(!strcmp(cmdtext, "/do", true, 3)) { if (!cmdtext[3]) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /do [Situation]"); new name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof name); format(cmdtext, 128, "* %s ( %s ) ", cmdtext[4], name ); new Float:x, Float:y, Float:z; GetPlayerPos(playerid, x, y, z); for(new i, m = GetMaxPlayers(); i < m; i++) if (IsPlayerConnected(i)) { if (IsPlayerInRangeOfPoint(i, 15.0, x, y, z)) SendClientMessage(i, COLOR_PURPLE, cmdtext); } return 1; }
Originally Posted by Assyria
2.
You have if statement witch checks if you are 15 units away from position: 161.37, -96.61, 1001.80. If you arent, it will sent that "You arent in cloth shop" message. |
Originally Posted by billiout
1.
im not sure because im new on scripting too but use instead of strlen the 3 number of your letters Код:
if(!strcmp(cmdtext, "/do", true, 3)) { if (!cmdtext[3]) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /do [Situation]"); new name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof name); format(cmdtext, 128, "* %s ( %s ) ", cmdtext[4], name ); new Float:x, Float:y, Float:z; GetPlayerPos(playerid, x, y, z); for(new i, m = GetMaxPlayers(); i < m; i++) if (IsPlayerConnected(i)) { if (IsPlayerInRangeOfPoint(i, 15.0, x, y, z)) SendClientMessage(i, COLOR_PURPLE, cmdtext); } return 1; } |