SA-MP Forums Archive
doing something with ignoring playerid? - 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: doing something with ignoring playerid? (/showthread.php?tid=176328)



doing something with ignoring playerid? - thomas.. - 12.09.2010

ok, so you would do this:

pawn Код:
if(!strcmp(cmdtext, "/bam", true))
        {
        SetPVarInt(playerid,"launcher",1);
        for(new i = 0; i < MAX_PLAYERS; i++)
        if(i!=playerid)
        {
        {
            GetPlayerPos(playerid,Xp, Yp,Zp);
            GetPlayerPos(i,Xt, Yt,Zt);
            if(IsPlayerInRangeOfPoint(i,TargetRange,Xp, Yp,Zp))
            {
            Vrocket[playerid] = CreateObject(ROCKETOBJECT, Xp, Yp,Zp+5,0.0,0.0,0.0,5.0); //
            MoveObject(Vrocket[playerid], Xt, Yt, Zt, ROCKETSPEED);
            }
except it follows the person who typed the command, not another closest person

can someone fix this for me?

where it follows the most closest person, excluding the person who typed the command

thx




Re: doing something with ignoring playerid? - Mauzen - 12.09.2010

pawn Код:
if(!strcmp(cmdtext, "/bam", true))
{
        SetPVarInt(playerid,"launcher",1);
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(i==playerid) continue;
            GetPlayerPos(playerid,Xp, Yp,Zp);
            GetPlayerPos(i,Xt, Yt,Zt);
            if(IsPlayerInRangeOfPoint(i,TargetRange,Xp, Yp,Zp))
            {
                Vrocket[playerid] = CreateObject(ROCKETOBJECT, Xp, Yp,Zp+5,0.0,0.0,0.0,5.0); //
                MoveObject(Vrocket[playerid], Xt, Yt, Zt, ROCKETSPEED);
                return 1;            //So that there are not multiple rockets
            }
        }
}



Re: doing something with ignoring playerid? - thomas.. - 12.09.2010

Quote:
Originally Posted by Mauzen
Посмотреть сообщение
pawn Код:
if(!strcmp(cmdtext, "/bam", true))
{
        SetPVarInt(playerid,"launcher",1);
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(i==playerid) continue;
            GetPlayerPos(playerid,Xp, Yp,Zp);
            GetPlayerPos(i,Xt, Yt,Zt);
            if(IsPlayerInRangeOfPoint(i,TargetRange,Xp, Yp,Zp))
            {
                Vrocket[playerid] = CreateObject(ROCKETOBJECT, Xp, Yp,Zp+5,0.0,0.0,0.0,5.0); //
                MoveObject(Vrocket[playerid], Xt, Yt, Zt, ROCKETSPEED);
                return 1;            //So that there are not multiple rockets
            }
        }
}
thanks

so that will shoot at the 2nd closest player?


Re: doing something with ignoring playerid? - thomas.. - 13.09.2010

bump:

doesnt work :l