Help in code
#1

its executed, but returns Server:Unknown command

Код:
if(strcmp(cmd, "/kill", true) == 0)
	{
		if(PlayerCuffed[playerid] > 0 || PlayerTied[playerid] > 0)
		{
			format(string, sizeof(string), "* %s starts to punch his own balls in an attempt to suicide, but instead pisses himself and starts crying.", PlayerRPName(playerid));
			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
			return 1;
		}
		if(PlayerInfo[playerid][pHospital] > 0 || PlayerInfo[playerid][pTut] != 1 || PlayerInfo[playerid][pJailed] == 2 || PlayerInfo[playerid][pJailed] == 3) // COMMENTED
		{
			SendClientMessage(playerid, COLOR_GREY,"   You cannot do that at this time !");
			return 1;
		}
		if(PlayerJustDied[playerid] == 1)
		{
		    SendClientMessage(playerid, COLOR_GREY,"   You cannot do that at this time !");
			return 1;
		}
		SetPlayerHealth(playerid, 0);
  	}
Reply
#2

all strcmp commands are return server:unknown command
Reply
#3

at the end of each commands put this:
PHP код:
return 1
like this one that you posted and i want to change it :
PHP код:
if(strcmp(cmd"/kill"true) == 0)
    {
        if(
PlayerCuffed[playerid] > || PlayerTied[playerid] > 0)
        {
            
format(stringsizeof(string), "* %s starts to punch his own balls in an attempt to suicide, but instead pisses himself and starts crying."PlayerRPName(playerid));
            
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            return 
1;
        }
        if(
PlayerInfo[playerid][pHospital] > || PlayerInfo[playerid][pTut] != || PlayerInfo[playerid][pJailed] == || PlayerInfo[playerid][pJailed] == 3// COMMENTED
        
{
            
SendClientMessage(playeridCOLOR_GREY,"   You cannot do that at this time !");
            return 
1;
        }
        if(
PlayerJustDied[playerid] == 1)
        {
            
SendClientMessage(playeridCOLOR_GREY,"   You cannot do that at this time !");
            return 
1;
        }
        
SetPlayerHealth(playerid0);
                return 
1;
      } 
Reply
#4

same problem if i set return 0 it works?
Reply
#5

Quote:
Originally Posted by krytans
Посмотреть сообщение
its executed, but returns Server:Unknown command

Код:
if(strcmp(cmd, "/kill", true) == 0)
	{
		if(PlayerCuffed[playerid] > 0 || PlayerTied[playerid] > 0)
		{
			format(string, sizeof(string), "* %s starts to punch his own balls in an attempt to suicide, but instead pisses himself and starts crying.", PlayerRPName(playerid));
			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
			return 1;
		}
		if(PlayerInfo[playerid][pHospital] > 0 || PlayerInfo[playerid][pTut] != 1 || PlayerInfo[playerid][pJailed] == 2 || PlayerInfo[playerid][pJailed] == 3) // COMMENTED
		{
			SendClientMessage(playerid, COLOR_GREY,"   You cannot do that at this time !");
			return 1;
		}
		if(PlayerJustDied[playerid] == 1)
		{
		    SendClientMessage(playerid, COLOR_GREY,"   You cannot do that at this time !");
			return 1;
		}
		SetPlayerHealth(playerid, 0);
  	}
Quote:
Originally Posted by ******
Посмотреть сообщение
Don't use strcmp.
Use ZCMD or y_cmd, for better command processor because strcmp is not recommended
Reply
#6

How to convert it to zcmd?
Reply
#7

Try this

make sure you have a include file of ZCMD
pawn Код:
#include <zcmd>
pawn Код:
CMD:kill(playerid,params)
{
    if(PlayerCuffed[playerid] > 0 || PlayerTied[playerid] > 0)
    {
    format(string, sizeof(string), "* %s starts to punch his own balls in an attempt to suicide, but instead pisses himself and starts crying.", PlayerRPName(playerid));
    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    return 1;
    }
    if(PlayerInfo[playerid][pHospital] > 0 || PlayerInfo[playerid][pTut] != 1 || PlayerInfo[playerid][pJailed] == 2 || PlayerInfo[playerid][pJailed] == 3) // COMMENTED
    {
    SendClientMessage(playerid, COLOR_GREY,"   You cannot do that at this time !");
    return 1;
    }
    if(PlayerJustDied[playerid] == 1)
    {
    SendClientMessage(playerid, COLOR_GREY,"   You cannot do that at this time !");
    return 1;
    }
    SetPlayerHealth(playerid, 0);
    return 1;
}
Reply
#8

I have bunch of commands in strcmp and i need to convert them to zcmd.
Is there any strcmp to zcmd coverter?
Reply
#9

Quote:
Originally Posted by krytans
Посмотреть сообщение
I have bunch of commands in strcmp and i need to convert them to zcmd.
Is there any strcmp to zcmd coverter?
PM me all your strcmp command i will convert it all
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)