My code should work. - 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: My code should work. (
/showthread.php?tid=363846)
My code should work. -
Rudy_ - 28.07.2012
it should explode when target is near the object (While the object is Moving)
pawn Код:
GetPlayerPos(targetid, tx, ty, tz);
if(IsPlayerInRangeOfPoint(targetid,3.0, x, y, z) && targetid != playerid && IsPlayerInAnyVehicle(targetid))
{
for(new i;i<MAX_PLAYERS;i++)
{
CreateExplosion(tx, ty, tz, 11, 5.0);
DestroyObject(gRocketObj[i]);
}
}
else if(!IsPlayerInRangeOfPoint(targetid,3.0, x, y, z))
{
}
}
}
it's under OnPlayerKeyStateChange and i'm using MoveObject
Re: My code should work. -
milanosie - 28.07.2012
Show the other pieces of the code,
I don't know what x, y and z are, don't know what targetid is, etc.
Show us
all information, and not 40%
Re: My code should work. -
Rudy_ - 29.07.2012
That's fixed.
It dosen't explode now when the object is "
Moving" & IsInRange of target
pawn Код:
forward detectbomb(playerid);
public detectbomb(playerid)
{
new
Float:tx,
Float:ty,
Float:tz,
Float:x,
Float:y,
Float:z;
for(new targetid = 0; targetid < MAX_PLAYERS; targetid++)
{
if(!IsPlayerConnected(targetid) || targetid == playerid || !IsPlayerInAnyVehicle(targetid)) continue;
GetPlayerPos(targetid, tx, ty, tz);
GetObjectPos(gRocketObj[playerid], x, y, z);
if(IsPlayerInRangeOfPoint(targetid, 3.0, x, y, z))
{
CreateExplosion(tx, ty, tz, 11, 5.0);
DestroyObject(gRocketObj[playerid]);
KillTimer(detecttimer[playerid]);
}
else if(!IsPlayerInRangeOfPoint(targetid,3.0, x, y, z))
{
}
}
return 1;
}
It should explode.
Re: My code should work. -
Rudy_ - 29.07.2012
It still dosen't works :/