doing something with ignoring playerid?
#1

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

Reply
#2

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
            }
        }
}
Reply
#3

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?
Reply
#4

bump:

doesnt work :l
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)