SA-MP Forums Archive
How to set another arrow on north? - 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: How to set another arrow on north? (/showthread.php?tid=629201)



How to set another arrow on north? - weex - 22.02.2017

I made this arrow:


Making this code:
Код:
		if(InCheckPoint[i] == true) {
			new Float:pX,Float:pY,Float:pZ;
			GetPlayerPos(i,pX,pY,pZ);
			for(new SID = 1; SID < MAX_CRIMES; SID++) {
				SetObjectPos(GPSArrow[i][SID],pX, pY, pZ-1);
				SetObjectRot(GPSArrow[i][SID],0,90,-90-AngleBetweenPoints(pX,pY,Xtargetpoint[i],Ytargetpoint[i]));
			}
		}
How to add more one arrow on north according to the arrow angle?

GPSArrow[i][1] = onplayer
GPSArrow[i][2] += 1.0 north

But it according with arrow angle?


Re: How to set another arrow on north? - weex - 22.02.2017

I tried to add on Y but not work well...
I want add another arrow on north of last arrow direction

Anybody know this?


Re: How to set another arrow on north? - BroZeus - 23.02.2017

This command creates 10 arrows one after another in player facing angle. Try it in game and combine its code with your.
PHP код:
CMD:arrow(playeridparams[])
{
    new 
Float:pX,Float:pY,Float:pZFloat:a;
    
GetPlayerFacingAngle(playerida);
    
GetPlayerPos(playerid,pX,pY,pZ);
    for(new 
110i++) {
        
pX += floatmul(2floatsin(-adegrees));
        
pY += floatmul(2floatcos(-adegrees));
        
CreateObject(1318pXpYpZ09090-a);
    }
    return 
1;




Re: How to set another arrow on north? - rt-2 - 23.02.2017

Quote:
Originally Posted by BroZeus
Посмотреть сообщение
This command creates 10 arrows one after another in player facing angle. Try it in game and combine its code with your.
PHP код:
CMD:arrow(playeridparams[])
{
    new 
Float:pX,Float:pY,Float:pZFloat:a;
    
GetPlayerFacingAngle(playerida);
    
GetPlayerPos(playerid,pX,pY,pZ);
    for(new 
110i++) {
        
pX += floatmul(2floatsin(-adegrees));
        
pY += floatmul(2floatcos(-adegrees));
        
CreateObject(1318pXpYpZ09090-a);
    }
    return 
1;

Quick look at this, why are you not using 'i' in your loop?

Its gonna make only one arrow, it's gonna go too fast I think


Re: How to set another arrow on north? - BroZeus - 23.02.2017

Quote:
Originally Posted by blinkpnk
Посмотреть сообщение
Quick look at this, why are you not using 'i' in your loop?

Its gonna make only one arrow, it's gonna go too fast I think
'i' was only needed if values were not being added to pX and pY, see carefully that i wrote "pX +=" So it keeps on adding distance in every iteration of loop


Re: How to set another arrow on north? - rt-2 - 17.03.2017

Quote:
Originally Posted by BroZeus
Посмотреть сообщение
'i' was only needed if values were not being added to pX and pY, see carefully that i wrote "pX +=" So it keeps on adding distance in every iteration of loop
Ho yeah ok, I missed that! Thanks.