SA-MP Forums Archive
Help with Mini-Pizza script. - 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: Help with Mini-Pizza script. (/showthread.php?tid=196756)



Help with Mini-Pizza script. - Chrillzen - 06.12.2010

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.


Re: Help with Mini-Pizza script. - Mauzen - 06.12.2010

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.