07.03.2010, 15:38
Hiya!
I was trying to make a shooting range script, so players can train their weapon skills.
I tried to make it so that players have to shoot a ball. This object moves if you hit it.
And then I could detect whether they hit it with GetObjectPos. If the position wasn't the position it spawned in, they had hit it.
But when I went to test this, it kept telling me it didnt move, even though I blew it 5 miles away with a rocket launcher.
my code:
So is there any way to detect whether an object has been shot?
I was trying to make a shooting range script, so players can train their weapon skills.
I tried to make it so that players have to shoot a ball. This object moves if you hit it.
And then I could detect whether they hit it with GetObjectPos. If the position wasn't the position it spawned in, they had hit it.
But when I went to test this, it kept telling me it didnt move, even though I blew it 5 miles away with a rocket launcher.
my code:
pawn Код:
// Object
luchtbal = CreateObject(1598, -1833.215698, 985.911194, 47.910473, 0.0000, 0.0000, 0.0000);
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/test", cmdtext, true, 10) == 0)
{
new Float: balx, Float: baly, Float: balz;
GetObjectPos(luchtbal, balx, baly, balz);
if(balx != -1833.215698 && baly != 985.911194 && balz != 47.910473)
{
GameTextForPlayer(playerid, "It moved!", 3000, 3);
}
if(balx == -1833.215698 && baly == 985.911194 && balz == 47.910473)
{
GameTextForPlayer(playerid, "It didn't move!", 3000, 3);
}
return 1;
}
return 0;
}