SA-MP Forums Archive
This shouldn't be happening? - 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: This shouldn't be happening? (/showthread.php?tid=474906)



This shouldn't be happening? - Tagathron - 10.11.2013

Код:
invalid expression, assumed zero
I get that error on the line:
pawn Код:
CMD:deployradio (playerid, params[])
{
    if(PRinfo[playerid][radioDeployed]==1) //PLayer already has 1 deployed
    {
        SendClientMessage(playerid, 0xFC00FCF, "You have already deployed an radio.");
    }
   
    for(new i=0;i<MAX_PLAYERS+1;i++)
    {
        if(IsPlayerInRangeOfPoint(playerid, 10.0, PRinfo[i][locX], PRinfo[i][locY], PRinfo[i][locZ]))//Cannont deploy if someone deployed already 1,near him
        {
            SendClientMessage(playerid, COLOR_GREY, "You can not place a radio near already existing one.Find another place");
        }
    }
   
    else // THIS LINE,but everything is fine?
    {
        ShowPlayerDialog(playerid, MUSIC_DIALOG, DIALOG_STYLE_LIST, "Choose a song", radioSongs, "OK", "");
    }

    return 1;
}



Re: This shouldn't be happening? - Emmet_ - 10.11.2013

pawn Код:
CMD:deployradio (playerid, params[])
{
    if(PRinfo[playerid][radioDeployed]==1) //PLayer already has 1 deployed
    {
        return SendClientMessage(playerid, 0xFC00FCF, "You have already deployed an radio.");
    }
    for(new i=0;i<MAX_PLAYERS+1;i++)
    {
        if(IsPlayerInRangeOfPoint(playerid, 10.0, PRinfo[i][locX], PRinfo[i][locY], PRinfo[i][locZ]))//Cannont deploy if someone deployed already 1,near him
        {
            SendClientMessage(playerid, COLOR_GREY, "You can not place a radio near already existing one.Find another place");
            return 1;
        }
    }
    ShowPlayerDialog(playerid, MUSIC_DIALOG, DIALOG_STYLE_LIST, "Choose a song", radioSongs, "OK", "");
    return 1;
}
You can't have an "else" statement under a "for".