SA-MP Forums Archive
ZCMD error - 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: ZCMD error (/showthread.php?tid=260926)



ZCMD error - marrcko - 11.06.2011

Hi, i have 1 error: this cmd works fine until 'tagas <1 ', but then 'tagas' is more than 1 then i get error : 'Server: command don't exist' (something like that). So maybe u can help me to find what is missing?
pawn Код:
CMD:graffiti(playerid, params[])
    {
    if (tagas >= MAX_TAGS)
            return SendClientMessage(playerid,RAUDONA,">>Limitas isnaudotas");
    new id = random(8), piesinys,
        Float:ox, Float:oy, Float:oz,
        Float:x, Float:y, Float:z, Float:Angle;
    switch(id)
        {
        case 0 : piesinys =18659;
        case 1 : piesinys =18660;
        case 2 : piesinys =18661;
        case 3 : piesinys =18662;
        case 4 : piesinys =18663;
        case 5 : piesinys =18664;
        case 6 : piesinys =18665;
        case 7 : piesinys =18666;
        case 8 : piesinys =18667;
        }
    GetPlayerPos(playerid, x, y, z);
    if (tagas > 1)
        {
        for (new i=0;i<=MAX_TAGS;i++)
            {
            GetObjectPos(graffiti[i],ox,oy,oz);
            if (IsPlayerInRangeOfPoint(playerid,10,ox,oy,oz))
                {
                DestroyObject(graffiti[i]);
                }
             }
        }
    GetPlayerFacingAngle(playerid, Angle);
    GetXYInFrontOfPlayer(playerid, x, y,1.0);
    graffiti[tagas] =CreateObject(piesinys, x, y ,z + 0.5, 0.0,0.0,Angle-270, 96.0);
    SendClientMessage(playerid, 0x0080FFFF, "Tagas nupiestas");
    tagas++;
    return 1;
    }



Re: ZCMD error - marrcko - 11.06.2011

I tried..nothing...
this 'tagas++' is necessary because i need limit of them.
P.S. I edited script.


Re: ZCMD error - Vince - 11.06.2011

pawn Код:
for (new i=0;i<=MAX_TAGS;i++)
Looks like Out Of Bounds error. Try this one:

pawn Код:
for (new i; i < MAX_TAGS; i++)



Re: ZCMD error - marrcko - 11.06.2011

thx Vince its working now well...