SA-MP Forums Archive
Problem with my friend code - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Problem with my friend code (/showthread.php?tid=200964)



Problem with my friend code - Face9000 - 19.12.2010

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?


Re: Problem with my friend code - Rafa - 19.12.2010

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


Re: Problem with my friend code - Face9000 - 19.12.2010

This are the warnings he got:

warning 225: unreachable code
warning 225: unreachable code
warning 225: unreachable code


Re: Problem with my friend code - XePloiT - 19.12.2010

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;
}



Re: Problem with my friend code - Face9000 - 19.12.2010

Thanks,he said me it's working.


Re: Problem with my friend code - XePloiT - 19.12.2010

no prob... tell him to enjoy...


Re: Problem with my friend code - Rafa - 19.12.2010

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


Re: Problem with my friend code - admantis - 19.12.2010

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


Re: Problem with my friend code - Face9000 - 19.12.2010

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

ManuWar.


Re: Problem with my friend code - Manuwar - 27.02.2011

XD Thanks To All Guys.