Help with Mini-Pizza script.
#1

Quote:

if (strcmp("/buypizza", cmdtext, true, 4) == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 7.0, 2695.6880, -1704.6300, 11.843)
{
if(pizza[playerid] == 1) return SendClientMessage(playerid,COLOR_GREY,"You've already bought a pizza!");
}
return 1;
}
else
{
SendClientMessage(playerid,COLOR_GREY,"You bought a pizza!");
GivePlayerMoney(playerid, -50);
pizza[playerid]=1;
return 1;
}
if (strcmp("/eatpizza", cmdtext, true, 9) == 0)
{
if(pizza[playerid] == 1)
{
SendClientMessage(playerid,COLOR_GREEN,"You ate your pizza!");
SetPlayerHealth(playerid,100);
pizza[playerid]=0;
return 1;
}
else
{
if(pizza[playerid] == 0) return SendClientMessage(playerid,COLOR_GREY,"You don't have a pizza!");
}
return 1;
}

Know how to fix it?
No errors, but it still does not help, when i write /buypizza som random text shows up.
Reply
#2

pawn Код:
if (strcmp("/buypizza", cmdtext, true) == 0)
{
    if(IsPlayerInRangeOfPoint(playerid, 7.0, 2695.6880, -1704.6300, 11.843)
    {
        if(pizza[playerid] == 1)
        {
            return SendClientMessage(playerid,COLOR_GREY,"You've already bought a pizza!");
        } else        
        {
            SendClientMessage(playerid,COLOR_GREY,"You bought a pizza!");
            GivePlayerMoney(playerid, -50);
            pizza[playerid]=1;            
        }
    }
    return 1;
}
The code was a bit messy, so I cleaned it up and corrected the bugs. You placed some {} wrong, so that the if-else stuff didnt work correctly. Compare it to yours to see what I changed in detail.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)