#include <a_samp> #define FILTERSCRIPT #define KEY_FOOT_FIRE 4 #define WEAPON_TEARGAS (17) #if defined FILTERSCRIPT public OnFilterScriptInit() { print("\n--------------------------------------"); print(" Tear Gas Thing "); print("--------------------------------------\n"); return 1; } public OnFilterScriptExit() { return 1; } new Smoke; new Smoke2; new Smoke3; new Smoke4; new Smoke5; public OnPlayerKeyStateChange(playerid,newkeys,oldkeys) { if((newkeys & KEY_FOOT_FIRE) == (KEY_FOOT_FIRE)) { if(!IsPlayerInAnyVehicle(playerid)) { new Float:x, Float:y, Float:z, Float:a; GetPlayerPos(playerid, x, y, z); GetPlayerFacingAngle(playerid, a); x += (15 * floatsin(-a, degrees)); y += (15 * floatcos(-a, degrees)); Smoke = CreateObject(2780, x, y, z-3, 0.0, 0.0, 0.0); Smoke2 = CreateObject(2780, x, y+5, z-3, 0.0, 0.0, 0.0); Smoke3 = CreateObject(2780, x, y-5, z-3, 0.0, 0.0, 0.0); Smoke4 = CreateObject(2780, x+5, y, z-3, 0.0, 0.0, 0.0); Smoke5 = CreateObject(2780, x-5, y, z-3, 0.0, 0.0, 0.0); GetObjectPos(Smoke, x, y, z); GetObjectPos(Smoke2, x, y, z); GetObjectPos(Smoke3, x, y, z); GetObjectPos(Smoke4, x, y, z); GetObjectPos(Smoke5, x, y, z); SetTimerEx("TearGasTimer2", 20000, 0, "d", playerid); if(IsPlayerInRangeOfPoint(playerid, 7, x, y, z)) { TogglePlayerControllable(playerid, 0); SetTimerEx("TearGasTimer", 20000, 0, "d", playerid); return 1; } } } return 0; } forward TearGasTimer(playerid); public TearGasTimer(playerid) { TogglePlayerControllable(playerid, 1); DestroyObject(Smoke); DestroyObject(Smoke2); DestroyObject(Smoke3); DestroyObject(Smoke4); DestroyObject(Smoke5); return 1; } forward TearGasTimer2(playerid); public TearGasTimer2(playerid) { DestroyObject(Smoke); DestroyObject(Smoke2); DestroyObject(Smoke3); DestroyObject(Smoke4); DestroyObject(Smoke5); return 1; } stock IsPlayerInRangeOfPoint(playerid, Float:range, Float:x, Float:y, Float:z) { // Created by ****** new Float:px, Float:py, Float:pz; GetPlayerPos(playerid, px, py, pz); px -= x; py -= y; pz -= z; return ((px * px) + (py * py) + (pz * pz)) < (range * range); } #endif
GetPlayerWeapon(playerid)
if(GetPlayerWeapon(playerid) == [Insert Teargas Weapon ID Here])
{
Your code...
}
if(!IsPlayerInAnyVehicle(playerid))
{
if(!IsPlayerInAnyVehicle(playerid) && GetPlayerWeapon(playerid) == [Insert Teargas Weapon ID Here])
{
Originally Posted by yezizhu
Never test but looks really nice^^
Why dont use animation instead of TogglePlayer and add DisablePlayerNameTag for better effect::P REALLY NICE IDEA! |