Problem with my friend code
#1

Hi,this topic isnt for me,my friend got a code problem

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
      if(strcmp(cmdtext,"/kill",true))
      SetPlayerHealth(playerid, 0);
      SendClientMessage(playerid, COLOR_RED, "Muori.");

      return 1;

      if(strcmp(cmdtext,"/heal",true))
      SetPlayerHealth(playerid, 100);
      SendClientMessage(playerid, COLOR_RED, "Vita ripristinata.");

      return 1;

      if(strcmp(cmdtext,"/armor",true))
      SetPlayerArmour(playerid, 100);
      SendClientMessage(playerid, COLOR_GREEN, "Armatura gratis.");
      return 1;

      return 0;
}
What he done wrong?
Reply
#2

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
      if(strcmp(cmdtext,"/kill",true) == 0)
      {
      SetPlayerHealth(playerid, 0);
      SendClientMessage(playerid, COLOR_RED, "Muori.");
      return 1;
}

      if(strcmp(cmdtext,"/heal",true) == 0)
{
      SetPlayerHealth(playerid, 100);
      SendClientMessage(playerid, COLOR_RED, "Vita ripristinata.");
      return 1;
}
      if(strcmp(cmdtext,"/armor",true) == 0)
      {
      SetPlayerArmour(playerid, 100);
      SendClientMessage(playerid, COLOR_GREEN, "Armatura gratis.");
      return 1;
}
      return 0;
}
}
try now
and btw what are the errors
Reply
#3

This are the warnings he got:

warning 225: unreachable code
warning 225: unreachable code
warning 225: unreachable code
Reply
#4

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
      if(!strcmp(cmdtext,"/kill",true))
      {
            SetPlayerHealth(playerid, 0);
            return SendClientMessage(playerid, COLOR_RED, "Muori.");
      }

      if(!strcmp(cmdtext,"/heal",true))
      {
            SetPlayerHealth(playerid, 100);
            return SendClientMessage(playerid, COLOR_RED, "Vita ripristinata.");
      }

      if(!strcmp(cmdtext,"/armor",true))
      {
            SetPlayerArmour(playerid, 100);
            return SendClientMessage(playerid, COLOR_GREEN, "Armatura gratis.");
      }

      return 0;
}
Reply
#5

Thanks,he said me it's working.
Reply
#6

no prob... tell him to enjoy...
Reply
#7

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext,"/kill",true) == 0)
    {
        SetPlayerHealth(playerid, 0);
        SendClientMessage(playerid, COLOR_RED, "Muori.");
        return 1;
    }

    if(strcmp(cmdtext,"/heal",true) == 0)
    {
         SetPlayerHealth(playerid, 100);
         SendClientMessage(playerid, COLOR_RED, "Vita ripristinata.");
         return 1;
    }
    if(strcmp(cmdtext,"/armor",true) == 0)
    {
         SetPlayerArmour(playerid, 100);
         SendClientMessage(playerid, COLOR_GREEN, "Armatura gratis.");
         return 1;
    }
    return 1;
    }
    return 0;
}
please tell him to try like this cause i want to know will work xD

thanks xD
Reply
#8

of course It wont work because there are no brackets or anything and the strcmp is wrongly formatted, but the post is already fixed.
Reply
#9

Quote:
Originally Posted by XePloiT
Посмотреть сообщение
no prob... tell him to enjoy...
Sure,he opened an account.

ManuWar.
Reply
#10

XD Thanks To All Guys.
Reply


Forum Jump:


Users browsing this thread: 8 Guest(s)