SA-MP Forums Archive
Command not working! - 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: Command not working! (/showthread.php?tid=446960)



Command not working! - San1 - 28.06.2013

Command i made is not setting the Price wtf??Anyone help?
On compile i get no errors

pawn Код:
CMD:setenfee(playerid, params[])
{
    new fee, bizid;
    if(PlayerInfo[playerid][pBizKey] != INVALID_BIZZ_ID && (IsPlayerInRangeOfPoint(playerid, 2.0, BizInfo[PlayerInfo[playerid][pBizKey]][XCoord], BizInfo[PlayerInfo[playerid][pBizKey]][YCoord], BizInfo[PlayerInfo[playerid][pBizKey]][ZCoord]) || IsPlayerInRangeOfPoint(playerid, 2.0, BizInfo[PlayerInfo[playerid][pBizKey]][IXCoord], BizInfo[PlayerInfo[playerid][pBizKey]][IYCoord], BizInfo[PlayerInfo[playerid][pBizKey]][IZCoord])))
    {
        if(sscanf(params, "i", fee)) return SendClientMessageEx(playerid, COLOR_GRAD3, "USAGE: /setenfee [fee]");
        BizInfo[bizid][EntranceFee] = fee;
        SaveBizInfo(bizid);
        LoadBizInfo(bizid);
        return 1;
    }
    else
    {
        SendClientMessageEx(playerid, COLOR_GRAD2, "You don't own a business, or are not at one of them.");
        return 1;
    }
}



Respuesta: Command not working! - JustBored - 28.06.2013

The thing that i think is causing that bug is that the ID isnt specified.
pawn Код:
CMD:setenfee(playerid, params[])
{
    if(PlayerInfo[playerid][pBizKey] != INVALID_BIZZ_ID && (IsPlayerInRangeOfPoint(playerid, 2.0, BizInfo[PlayerInfo[playerid][pBizKey]][XCoord], BizInfo[PlayerInfo[playerid][pBizKey]][YCoord], BizInfo[PlayerInfo[playerid][pBizKey]][ZCoord]) || IsPlayerInRangeOfPoint(playerid, 2.0, BizInfo[PlayerInfo[playerid][pBizKey]][IXCoord], BizInfo[PlayerInfo[playerid][pBizKey]][IYCoord], BizInfo[PlayerInfo[playerid][pBizKey]][IZCoord])))
    {
        if(sscanf(params, "i", params[0])) return SendClientMessageEx(playerid, COLOR_GRAD3, "USAGE: /setenfee [fee]");
        BizInfo[PlayerInfo[playerid][pBizKey]][EntranceFee] = params[0];
        SaveBizInfo(PlayerInfo[playerid][pBizKey]);
        LoadBizInfo(PlayerInfo[playerid][pBizKey]);
       // return 1; їWhy returning 1?
    }
    else
    {
        SendClientMessageEx(playerid, COLOR_GRAD2, "You don't own a business, or are not at one of them.");
        return 1;
    }
}



Re: Command not working! - CoaPsyFactor - 28.06.2013

Well, return 1 is not problem, where do you set bizid, you only made instance of it. but there is nothing like

bizid = PlayerInfo[playerid][pBizKey]