18.01.2011, 00:02
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/smack", cmdtext, true, 6))
{
new targetid = strval(cmdtext[6]);
new Float:x, Float:y, Float:z;
new Float:health;
GetPlayerHealth(targetid, health);
new pName [MAX_PLAYER_NAME], tName [MAX_PLAYER_NAME], string [128];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
GetPlayerName(targetid, tName, MAX_PLAYER_NAME);
if(string[playerid] > '9' || string[playerid] < '0') return SendClientMessage(playerid,COLOR_RED,"ID must be a number");
if(cmdtext[6] == 0) return SendClientMessage(playerid,COLOR_RED,"USAGE: /smack <ID>");
if(GetPlayerPos(targetid, x, y, z) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "Invalid ID");
if(!IsPlayerNearPlayer(playerid, targetid, 2.0)) return SendClientMessage(playerid, 0xFFFFFFFF, "Not Near");
if (health < 50.0)
{
format(string, sizeof(string), "%s(%d) has smacked %s(%d) to death",pName, playerid, tName, targetid);
SendClientMessageToAll(0xFF0000FF, string);
SetPlayerHealth(targetid, 0);
return 1;
}
else
{
format(string, sizeof(string), "%s(%d) has smacked %s(%d)",pName, playerid, tName, targetid);
SendClientMessageToAll(0xFF0000FF, string);
return 1;
}
}
pawn Код:
if(string[playerid] > '9' || string[playerid] < '0') return SendClientMessage(playerid,COLOR_RED,"ID must be a number");
/
/s
/sm
/sma
/smac
So? How to fix my crashing problem :S