13.03.2012, 06:56
I get no errors but when i try and enter the command it wont work, Help? and don't say use ZCMD or any other StupidCMD.
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new string[256];
new string1[256];
new pName[MAX_PLAYER_NAME];
new cmd[256];
new tmp[256];
new giveplayerid;
new idx;
cmd = strtok(cmdtext, idx);
tmp = strtok(cmdtext, idx);
//-------------------------[Commands]-----------------------------
if(strcmp(cmd, "/cmds", true) == 0)
{
SendClientMessage(playerid, 0x0000FFFF, "/cmds");
return 1;
}
if(strcmp(cmd, "/gethealth", true) == 0)
{
if(PlayerInfo[playerid][Admin] >= 1)
{
new Float:Health;
giveplayerid = ReturnUser(tmp);
new pHealth;
pHealth = GetPlayerHealth(giveplayerid, Health);
GetPlayerName(giveplayerid, pName, sizeof(pName));
format(string, sizeof(string), "Player: %s 's Health is %s", pName, pHealth);
SendClientMessage(playerid, 0xFF9900FF, string);
return 1;
}
else SendClientMessage(playerid, 0x99FF00FF, "You are not an Admin!");
return 1;
}
if(strcmp(cmd, "/green", true) == 0)
{
SetPlayerColor(playerid, 0x00CC00FF);
return 1;
}
if(strcmp(cmd, "/red", true) == 0)
{
SetPlayerColor(playerid, 0xFF0033FF);
return 1;
}
if(strcmp(cmd, "/setmyskin", true) == 0)
{
new skin = strval(tmp);
SetPlayerSkin(playerid, skin);
return 1;
}
if(strcmp(cmd, "/givemoney", true) == 0)
{
if(PlayerInfo[playerid][Admin] >= 3)
{
GetPlayerName(giveplayerid, pName, sizeof(pName));
new money = strval(tmp);
GivePlayerMoney(giveplayerid, money);
format(string, sizeof(string), "You have given %s $%s", pName, money);
SendClientMessage(playerid, 0xFFFF00FF, string);
format(string1, sizeof(string1), "You have recieved $%s from an Admin!", money);
SendClientMessage(giveplayerid, 0xFFFF00FF, string1);
return 1;
}
else SendClientMessage(playerid, 0x99FF00FF, "You are not an Admin!");
return 1;
}
if(strcmp(cmd, "/sethealth", true) == 0)
{
if(PlayerInfo[playerid][Admin] >= 2)
{
new health = strval(tmp);
GetPlayerName(giveplayerid, pName, sizeof(pName));
SetPlayerHealth(giveplayerid, health);
format(string, sizeof(string), "You have set Player: %'s health to %s", pName, health);
SendClientMessage(playerid, 0xFFFF00FF, string);
return 1;
}
else SendClientMessage(playerid, 0x99FF00FF, "You are not an Admin!");
return 1;
}
return 1;
}