SA-MP Forums Archive
command help[rep] - 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 help[rep] (/showthread.php?tid=325219)



command help[rep] - WardenCS - 12.03.2012

Hello,i tried to edit the spikestrip include command but when im not at the pos,it will spam the message you have to be near a spikestrip,can someone tell me how to fix it?

Код:
CMD:removestrip(playerid, params[])
{
		if(Createdstrip[playerid] == 0)
		{
    	SendClientMessage(playerid, COLOR_GRAD2,"You haven't created a spike strip.");
    	return 1;
    	}
    	for(new i = 0; i < sizeof(SpikeInfo); i++)
  		{
  	    if(IsPlayerInRangeOfPoint(playerid, 2.0, SpikeInfo[i][sX], SpikeInfo[i][sY], SpikeInfo[i][sZ]))
        {
    	SendClientMessage(playerid, COLOR_GRAD2,"You have removed the spike strip.");
        DeleteClosestStrip(playerid);
  		Createdstrip[playerid] = 0;
  		}
		else
		{
    	SendClientMessage(playerid, COLOR_GRAD2,"You have to be near spike strip.");
    	}
    	}
		return 1;
	}



Re: command help[rep] - Shabi RoxX - 12.03.2012

Try This:
pawn Код:
CMD:removestrip(playerid, params[])
{
    if(Createdstrip[playerid] == 0)
    {
        SendClientMessage(playerid, COLOR_GRAD2,"You haven't created a spike strip.");
        return 1;
    }
    for(new i = 0; i <= sizeof(SpikeInfo); i++)
    {
        if(IsPlayerInRangeOfPoint(playerid, 2.0, SpikeInfo[i][sX], SpikeInfo[i][sY], SpikeInfo[i][sZ]))
        {
            SendClientMessage(playerid, COLOR_GRAD2,"You have removed the spike strip.");
            DeleteClosestStrip(playerid);
            Createdstrip[playerid] = 0;
            return 1;
        }
        else
        if(i = sizeof(SpikeInfo))
        {
            SendClientMessage(playerid, COLOR_GRAD2,"You have to be near spike strip.");
        }
    }
    return 1;
}
Edited::


Re: command help[rep] - WardenCS - 12.03.2012

thanks,it did work