CreatePickup(1212, 1,x,y,z, -1); |
i need help with this pickup code.
when i created a pickup, it doesnt create in front of me, it create under me. i want it to create in front of me when i create one but i cant get this code edit. please help me. |
new
Float: pPos[4],
Float: dPos[3],
distanceFromPlayer = 1
;
// pPos - player's position,
// dPos - destination position
// distanceFromPlayer - some variable, adjust it for yourself.
GetPlayerPos(
playerid,
pPos[0], pPos[1], pPos[2]
);
GetPlayerFacingAngle(
playerid,
pPos[3]
);
pPos[3] = 360 - pPos[3];
dPos[0] = pPos[0] + distanceFromPlayer * floatsin( pPos[3], degrees ); // x coordinate
dPos[1] = pPos[1] + distanceFromPlayer * floatcos( pPos[3], degrees ); // y coordinate
dPos[2] = pPos[2] + 0.35; // z coordinate
#define DISTANCE 5 new Float:x, Float:y, Float:z, Float:ang; GetPlayerPos(playerid,x,y,z); GetPlayerFacingAngle(playerid, ang); x += (DISTANCE * floatsin(-ang, degrees)); y += (DISTANCE * floatcos(-ang, degrees)); CreatePickup(1212, 1, x, y, z, -1);
Much easier than this Suni, look my code.
It will create pickup at 5 units in front of you (I hope so!) Change if you want nearer. Код:
#define DISTANCE <a href="http://cityadspix.com/tsclick-CQBE4NP0-MKIGQL0P?url=http%3A%2F%2Fwww.pleer.ru%2F_111837_toshiba_store_canvio_1tb_black_hdtc710ek3aa.html&sa=mh&sa1=&sa2=&sa3=&sa4=&sa5=&bt=20&pt=9<=2&tl=3&sa=mh&sa1=&sa2=&sa3=&sa4=&sa5=&im=MjgyNS0wLTE0MjcwMzk5MTEtMTM1NjMwNzY%3D&fid=NDQ1NzU2Nzc1&prdct=0e380030043e063003&kw=5%0Anew" target="_blank" alt="Toshiba STOR.E CANVIO 2.5 (new) 1TB" title="Toshiba STOR.E CANVIO 2.5 (new) 1TB" style="">5 new</a> Float:x, Float:y, Float:z, Float:ang; GetPlayerPos(playerid,x,y,z); GetPlayerFacingAngle(playerid, ang); x += (DISTANCE * floatsin(-ang, degrees)); y += (DISTANCE * floatcos(-ang, degrees)); CreatePickup(1212, 1, x, y, z, -1); |