#1

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
Reply
#2

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

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
Reply
#4

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

Line:SetPlayerHealth(playerid,100.00);
Reply
#5

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.
Reply
#6

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

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;
}
Reply
#8

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

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

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

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

The Return must not include
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)