SA-MP Forums Archive
Help - 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)
+--- Thread: Help (/showthread.php?tid=372800)



Help - Team_PRO - 28.08.2012

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/armour", cmdtext, true, 10) == 0)
    {
        // if(GetPlayerMoney(playerid)<1000)
        return SendClientMessage(playerid,0xFF0000,"You Need 1000 To Buy Armour.");
        SetPlayerArmour(playerid,100.00);
        SendClientMessage(playerid,0xFF0000,"You Have Buy Armour By Invisible Ammunation.");
   
     return 1;
   
    }

Error
unreachable code
Loost indentation
compound statement not close at the end of file (started at line 36)

If you help +rep


Re: Help - CrystalFire - 28.08.2012

1.Which is line 36?
2.use [ pawn][/pawn] tags for the code


Re: Help - SounDD - 28.08.2012

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/armour", cmdtext, true, 10) == 0)
{
if(GetPlayerMoney(playerid)<1000)
return SendClientMessage(playerid,0xFF0000,"You Need 1000 To Buy Armour.");
SetPlayerArmour(playerid,100.00);
SendClientMessage(playerid,0xFF0000,"You Have Buy Armour By Invisible Ammunation.");
return 1;
}
Try this


Re: Help - Team_PRO - 28.08.2012

armour)2.pwn(67) : warning 225: unreachable code

Line:SetPlayerHealth(playerid,100.00);


Re: Help - CrystalFire - 28.08.2012

Use
pawn Код:
SetPlayerHealth(playerid, 100);
not
pawn Код:
SetPlayerHealth(playerid,100.00);
Health cant be set in decimals nor can be armour..I can see you have done the same mistake with armour also..BTW you dont have any SetPlayerHealth line in the code u gave us, but i think it would be the same mistake as you have done in SetPlayerArmour.


Re: Help - clarencecuzz - 28.08.2012

There is no SetPlayerHealth line in your script... you need to show us 20 lines below and above the line giving you the error.


Re: Help - Team_PRO - 28.08.2012

Here is the full code
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/healme", cmdtext, true, 10) == 0)
    {
        // if(GetPlayerMoney(playerid)<1000)
        return SendClientMessage(playerid,0xFF0000,"You Need 1000 To Buy Health.");
        SetPlayerHealth(playerid, 100);
        SendClientMessage(playerid,0xFF0000,"You Have Buy Health For 1000.");
       
       
        return 1;
    }
    return 0;
}



Re: Help - CrystalFire - 28.08.2012

Un-Comment the GetPlayerMoney line...and please fix your SetPlayerArmour code which you showed us earlier.


Re: Help - clarencecuzz - 28.08.2012

if(GetPlayerMoney(playerid) < 1000)
return SendClientMessage....

You cannot have more than 1 return in a single statement.
Uncomment the line if(GetPlayerMoney... etc.


Re: Help - Team_PRO - 28.08.2012

Yes Its Fixed The Wrong its This
return SendClientMessage(playerid,0xFF0000,"You Need 1000 To Buy Health.");

The Return must not include