How to destroy object when touch it. [+REP] -
finelaq - 07.09.2014
How to make this that when player touch object, then it destroy.
pawn Код:
forward removeObjects();
forward remove();
CMD:lol(playerid, paramas[])
{
new Float:x, Float:y, Float:z, Float:a;
GetPlayerFacingAngle(playerid, a);
GetPlayerPos(playerid, x, y, z);
CreateObject(3409, x, y, z - 1.3, 0.0, 0.0, a + 90);
SetTimer("removeObjects", 5000, false);
return 1;
}
public removeObjects()
{
remove();
return 1;
}
public remove()
{
// Here i want that, when player touch this object what player made in CMD:lol then it destroy it.
return 1;
}
Please help me! +REP
Re: How to destroy object when touch it. [+REP] -
MasonSFW - 07.09.2014
pawn Код:
forward RemoveObjects();
new object;
CMD:lol(playerid, paramas[])
{
new Float:x, Float:y, Float:z, Float:a;
GetPlayerFacingAngle(playerid, a);
GetPlayerPos(playerid, x, y, z);
object = CreateObject(3409, x, y, z - 1.3, 0.0, 0.0, a + 90);
SetTimer("RemoveObjects", 5000, 1);
return 1;
}
public RemoveObjects()
{
DestroyObject(object);
return 1;
}
Re: How to destroy object when touch it. [+REP] -
finelaq - 07.09.2014
Quote:
Originally Posted by MasonSFW
pawn Код:
forward RemoveObjects();
new object;
CMD:lol(playerid, paramas[]) { new Float:x, Float:y, Float:z, Float:a; GetPlayerFacingAngle(playerid, a); GetPlayerPos(playerid, x, y, z); object = CreateObject(3409, x, y, z - 1.3, 0.0, 0.0, a + 90); SetTimer("RemoveObjects", 5000, true); return 1; }
public RemoveObjects() { // If player touch object DestroyObject(object); return 1; }
|
But it destroy the object when timer ends, but i want when player touch object
Re: How to destroy object when touch it. [+REP] -
finelaq - 07.09.2014
Quote:
Originally Posted by Ralfie
pawn Код:
new Float:ObjectX, ObjectY, ObjectZ; new OTimer; forward removeObjects();
CMD:lol(playerid, paramas[]) { new Float:x, Float:y, Float:z, Float:a; GetPlayerFacingAngle(playerid, a); GetPlayerPos(playerid, x, y, z); CreateObject(3409, x, y, z - 1.3, 0.0, 0.0, a + 90); ObjectX = x; ObjectY = y; ObjectZ = z; OTimer = SetTimer("removeObjects", 1000, true); return 1; }
public removeObjects() { foreach (new i : Player) //use normal loop if ur not using foreach { if(IsPlayerInRangeOfPoint(i, 1, ObjectX, ObjectY, ObjectZ)) { //destroy the objects, hes very close to it, send a message etc. KillTimer(OTimer); } } return 1; }
|
Hmm... i get 2 warning, idk why
Код:
C:\Users\Monster\Desktop\Eesti Fun Server\gamemodes\EFS.pwn(670) : warning 213: tag mismatch
C:\Users\Monster\Desktop\Eesti Fun Server\gamemodes\EFS.pwn(671) : warning 213: tag mismatch
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
2 Warnings.
Re: How to destroy object when touch it. [+REP] -
Evocator - 07.09.2014
Missed this, sorry
new Float:ObjectX, ObjectY, ObjectZ;
TO
new Float:ObjectX, Float:ObjectY, Float:ObjectZ;
Re: How to destroy object when touch it. [+REP] -
finelaq - 07.09.2014
Quote:
Originally Posted by Ralfie
Missed this, sorry
new Float:ObjectX, ObjectY, ObjectZ;
TO
new Float:ObjectX, Float:ObjectY, Float:ObjectZ;
|
okay, i gonna test it. If it works then you get +rep