#include <a_samp>
new bullet;
public OnFilterScriptInit()
{
bullet = CreateObject(3279,268.89947510,1884.10241699,-47.12563324,0.00000000,0.00000000,0.00000000); //object(a51_spottower) (1)
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/boom", true) == 0)
{
MoveObject(bullet, 268.89947510,1884.10241699,-47.12563324, 5000.0);
return 1;
}
return 0;
}
#include <a_players> public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if (newkeys & KEY_FIRE) { SetPlayerAttachedObject;(playerid, 1, 3279, 1, 0, 3, 0, 90, 0, 0, 1, 1, 1); } return 1; }
#include <a_samp> #include <a_players> #define PRESSED(%0) \ (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)) public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if (PRESSED(KEY_FIRE)) { new SetPlayerAttachedObject;(playerid, 1, 3279, 1, 0, 3, 0, 90, 0, 0, 1, 1, 1); } return 1; }
i am making a canon for a friend, it works like this, it shoots a platform in the air, and if it is up as far as possible the platfor must reset, so i thought of a timer that resets it in about 1 second, cuz the canon is going so fast it will only take that short, but the prob is i don't know how to do it, this is the script so far
Код HTML:
#include <a_samp>
new bullet;
public OnFilterScriptInit()
{
bullet = CreateObject(3279,268.89947510,1884.10241699,-47.12563324,0.00000000,0.00000000,0.00000000); //object(a51_spottower) (1)
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/boom", true) == 0)
{
MoveObject(bullet, 268.89947510,1884.10241699,-47.12563324, 5000.0);
return 1;
}
return 0;
}
|
#include <a_samp> new bullet; forward RemoveBullet(); public OnFilterScriptInit() { bullet = CreateObject(3279,268.89947510,1884.10241699,-47.12563324,0.00000000,0.00000000,0.00000000); //object(a51_spottower) (1) return 1; } public OnPlayerCommandText(playerid, cmdtext[]) { if(strcmp(cmdtext, "/boom", true) == 0) { MoveObject(bullet, 268.89947510,1884.10241699,-47.12563324, 5000.0); SetTimer("RemoveBullet", 10000, false); return 1; } return 0; } public RemoveBullet() { DestroyObject(bullet); }
Try this:
Код:
#include <a_samp> new bullet; forward RemoveBullet(); public OnFilterScriptInit() { bullet = CreateObject(3279,268.89947510,1884.10241699,-47.12563324,0.00000000,0.00000000,0.00000000); //object(a51_spottower) (1) return 1; } public OnPlayerCommandText(playerid, cmdtext[]) { if(strcmp(cmdtext, "/boom", true) == 0) { MoveObject(bullet, 268.89947510,1884.10241699,-47.12563324, 5000.0); SetTimer("RemoveBullet", 10000, false); return 1; } return 0; } public RemoveBullet() { DestroyObject(bullet); } |
public RemoveBullet()
{
DestroyObject(bullet);
bullet = CreateObject(3279,268.89947510,1884.10241699,-47.12563324,0.00000000,0.00000000,0.00000000); //object(a51_spottower) (1)
}