SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 21/11/2019, 05:11 AM   #1
binnyl
Huge Clucker
 
Join Date: Aug 2017
Posts: 257
Reputation: 6
Default how to detect the pos where bomb drops?

how to detect the pos where bomb drops?

i want to increment tear gas bomb to create a smoke grenade like on cs go with this object:
https://dev.prineside.com/en/gtasa_s...earch/?q=18715


for now i have this script, but it is working pretty bad, not get even close the position:

top of GM
pawn Code:
// granade pos 1
new TimerKFPressed[MAX_PLAYERS];

public OnPlayerDisconnect(playerid, reason) {
pawn Code:
// granade pos 2
    if(TimerKFPressed[playerid]) StopPressing(playerid);

public OnPlayerDeathEx(playerid) {
pawn Code:
// granade pos 3
    if(TimerKFPressed[playerid]) StopPressing(playerid);

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
pawn Code:
// granade pos 4
        else if(newkeys & KEY_FIRE && IsAGrenade(GetPlayerWeapon(playerid)) )
        {
            if(TimerKFPressed[playerid]) StopPressing(playerid); //If it's already started we stop it here
            TimerKFPressed[playerid] = SetTimerEx("PressingKey",1000,true,"i",playerid); //And start it again
        }

public OnPlayerUpdate(playerid)
pawn Code:
// granade pos 5
        if(TimerKFPressed[playerid] && GetPVarInt(playerid,"PressingSecs") >= 5) StopPressing(playerid);

pawn Code:
// granade pos 6
forward PressingKey(playerid);
public PressingKey(playerid)
{
    SetPVarInt(playerid,"PressingSecs",GetPVarInt(playerid,"PressingSecs")+1);
    return 1;
}

pawn Code:
// granade pos 7
stock StopPressing(playerid)
{
    KillTimer(TimerKFPressed[playerid]);
    //new str[35];
    //format(str,sizeof(str),"Key pressed for %d seconds",GetPVarInt(playerid,"PressingSecs"));
    new seconds = GetPVarInt(playerid,"PressingSecs");
    new Float:Px, Float:Py, Float:Pz;
    GetPlayerPos(playerid, Px, Py, Pz);
    GetXYInFrontOfPlayer(playerid, Px, Py, seconds*5);
        // smoke grenade FUNCTION
        SetTimerEx("PlantarSmoke2", 500, 0, "ifffi", playerid, Px, Py, Pz, 2);
    //SendClientMessage(playerid,-1,str);
    SetPVarInt(playerid,"PressingSecs",0); //Here we reset the seconds so when he will press it again we can count the new seconds
    TimerKFPressed[playerid] = 0; //We reset this so it could pass the check if(TimerPressed[playerid])
        // remomve grenades
        SetTimerEx("removerGranada", 500, 0, "iii", playerid, SWthrow[playerid], SWthrowTYPE[playerid]);
}


is anyone could help me to get the position or get my script better?
binnyl is offline   Reply With Quote
Old 21/11/2019, 06:27 AM   #2
AbyssMorgan
Banned
 
Join Date: Apr 2015
Location: Poland
Posts: 1,211
Reputation: 352
Default Re: how to detect the pos where bomb drops?

https://forum.sa-mp.com/showthread.php?p=4115827
AbyssMorgan is offline   Reply With Quote
Old 21/11/2019, 02:52 PM   #3
binnyl
Huge Clucker
 
Join Date: Aug 2017
Posts: 257
Reputation: 6
Default Re: how to detect the pos where bomb drops?

lol your script is amazing...
gz

but i want to make it so different, i just need to get the position where bomb was dropped

how to take it?

i need to get this function with what?
pawn Code:
//Hook: OnPlayerDroppingGrenade
public OnPlayerDroppingGrenade(playerid,weaponid,Float:x,Float:y,Float:z){
    new special_weaponid = Grenade::GetSpecialWeaponID(weaponid);
    if(special_weaponid != GRENADE_SPECIAL_WEAPON_NONE){
        if(Grenade::IsWeaponEnable(playerid,special_weaponid) && Grenade::GetSpecialAmmo(playerid,special_weaponid) > 0){
            Grenade::SetSpecialAmmo(playerid,special_weaponid,Grenade::GetSpecialAmmo(playerid,special_weaponid)-1);
            Grenade::GrenadeEffectByPlayer(playerid,special_weaponid,x,y,z);
        }
    }
    #if defined EG_OnPlayerDroppingGrenade
        EG_OnPlayerDroppingGrenade(playerid,weaponid,x,y,z);
    #endif
    return 1;
}

#if defined EG_OnPlayerDroppingGrenade
    forward EG_OnPlayerDroppingGrenade(playerid,weaponid,Float:x,Float:y,Float:z);
#endif
#if defined _ALS_OnPlayerDroppingGrenade
    #undef OnPlayerDroppingGrenade
#else
    #define _ALS_OnPlayerDroppingGrenade
#endif
#define OnPlayerDroppingGrenade EG_OnPlayerDroppingGrenade

from your full script: https://pastebin.com/uhcCFxrv
put on pastebin to easy to you if u dont have it in your computer anymore
binnyl is offline   Reply With Quote
Old 22/11/2019, 05:50 PM   #4
binnyl
Huge Clucker
 
Join Date: Aug 2017
Posts: 257
Reputation: 6
Default Re: how to detect the pos where bomb drops?

fuck, he got banned
is anyone else know how to help me?
binnyl is offline   Reply With Quote
Old 22/11/2019, 07:54 PM   #5
WalkZ
Big Clucker
 
WalkZ's Avatar
 
Join Date: Oct 2019
Location: Pakistan
Posts: 100
Reputation: 4
Default Re: how to detect the pos where bomb drops?

Its obvious you are planting object on Px Py Pz so that is position where it will drop
__________________
[EN] Chinatown Freeroam [BETA]
- Different Advanced Deathmatches with Times and Scores
- Different Races
- Different Events
- Gangs (Groves, Ballas, Aztecas, Mafia, Bikers & Triads)
- Drugs with Drug Dealers at Streets
- Hitman Bounty System
- Ammunations, Pizza Stacks, Burger-Shots, Banks
- Jobs (Pizza-Boy, Plumber, Trasher, Bus)
- Money-Bag every 30 minutes
- Reaction Test every 15 minutes
- Daily improving by adding new features and fixing present bugs.
WalkZ is offline   Reply With Quote
Old 23/11/2019, 09:42 AM   #6
coool
Gangsta
 
coool's Avatar
 
Join Date: Feb 2013
Location: Republic of Pakistan
Posts: 608
Reputation: 54
Default Re: how to detect the pos where bomb drops?

Search projectile motion maybe it is what you need?
__________________
coool is offline   Reply With Quote
Old 02/12/2019, 04:57 AM   #7
binnyl
Huge Clucker
 
Join Date: Aug 2017
Posts: 257
Reputation: 6
Default Re: how to detect the pos where bomb drops?

Quote:
Originally Posted by WalkZ View Post
Its obvious you are planting object on Px Py Pz so that is position where it will drop
What are u talking about?
I was not talking about my script
I was talking about his

Mine is poor, dont get the bomb position, not even close

Quote:
Originally Posted by coool View Post
Search projectile motion maybe it is what you need?
This one? https://forum.sa-mp.com/showthread.php?t=630602
How could i get where the bomb drops (position) with this?
binnyl is offline   Reply With Quote
Old 02/12/2019, 09:48 AM   #8
coool
Gangsta
 
coool's Avatar
 
Join Date: Feb 2013
Location: Republic of Pakistan
Posts: 608
Reputation: 54
Default Re: how to detect the pos where bomb drops?

Quote:
Originally Posted by binnyl View Post
This one? https://forum.sa-mp.com/showthread.php?t=630602
How could i get where the bomb drops (position) with this?
Yes, this include implements Physics formulas in-game so that other people should have an easy time
pawn Code:
new bombProjectile;
UnderWhereeverYouCreateBomb(playerid)
{
    new Float:x,Float:y,Float:z;
    GetPlayerPos(playerid,x,y,z); //because we want to create the bomb from player's position.
    bombProjectile=CreateProjectile(x,y,z,vx,vy,vz); //You have to obtain velocity (vx, vy, vz) yourself.
}
public OnProjectileStop(projid)
{
    if (projid==bombProjectile) //To be sure if it is the projectile we want, in case you create other projectiles
    {
         new Float:x, Float:y, Float:z;
         GetProjectilePos(projid, x, y, z); //Now x, y, z is the location where the bomb has dropped.
    }
}
__________________
coool is offline   Reply With Quote
Old 03/12/2019, 04:48 PM   #9
binnyl
Huge Clucker
 
Join Date: Aug 2017
Posts: 257
Reputation: 6
Default Re: how to detect the pos where bomb drops?

did u put this include to work?

i tried your code with:
Code:
#include <projectile>
https://raw.githubusercontent.com/Ag...projectile.inc


And then trhow this a lot of errors in others includes
Code:
/lib/include/YSI\..\YSI_Data\..\YSI_Internal\..\YSI_Core\..\YSI_Internal\y_version.inc(283) : warning 219: local variable "index" shadows a variable at a preceding level
/lib/include/YSI\..\YSI_Data\..\YSI_Internal\..\YSI_Core\..\YSI_Storage\..\YSI_Internal\..\amx\amx_header.inc(288) : warning 219: local variable "index" shadows a variable at a preceding level
/lib/include/YSI\..\YSI_Data\..\YSI_Internal\..\YSI_Core\..\YSI_Storage\..\YSI_Internal\..\amx\amx_header.inc(333) : warning 219: local variable "index" shadows a variable at a preceding level
/lib/include/YSI\..\YSI_Data\..\YSI_Internal\..\YSI_Core\..\YSI_Storage\..\YSI_Internal\..\amx\amx_header.inc(343) : warning 219: local variable "index" shadows a variable at a preceding level
/lib/include/YSI\..\YSI_Data\..\YSI_Internal\..\YSI_Core\..\YSI_Storage\..\YSI_Internal\..\amx\amx_header.inc(356) : warning 219: local variable "index" shadows a variable at a preceding level
/lib/include/YSI\..\YSI_Data\..\YSI_Internal\..\YSI_Core\..\YSI_Storage\..\YSI_Internal\..\amx\amx_header.inc(393) : warning 219: local variable "index" shadows a variable at a preceding level
/lib/include/YSI\..\YSI_Data\..\YSI_Internal\..\YSI_Core\..\YSI_Storage\..\YSI_Internal\..\amx\amx_header.inc(433) : warning 219: local variable "index" shadows a variable at a preceding level
/lib/include/YSI\..\YSI_Data\..\YSI_Internal\..\YSI_Core\..\YSI_Storage\..\YSI_Internal\..\amx\amx_header.inc(443) : warning 219: local variable "index" shadows a variable at a preceding level
/lib/include/YSI\..\YSI_Data\..\YSI_Internal\..\YSI_Core\..\YSI_Storage\..\YSI_Internal\..\amx\amx_header.inc(456) : warning 219: local variable "index" shadows a variable at a preceding level
/lib/include/YSI\..\YSI_Data\..\YSI_Internal\..\YSI_Core\..\YSI_Storage\..\YSI_Internal\..\amx\amx_header.inc(476) : warning 219: local variable "index" shadows a variable at a preceding level
/lib/include/YSI\..\YSI_Data\..\YSI_Internal\..\YSI_Core\..\YSI_Storage\..\YSI_Internal\..\amx\amx_header.inc(538) : warning 219: local variable "index" shadows a variable at a preceding level
/lib/include/YSI\..\YSI_Data\..\YSI_Internal\..\YSI_Core\..\YSI_Storage\..\YSI_Internal\..\amx\amx_header.inc(548) : warning 219: local variable "index" shadows a variable at a preceding level
/lib/include/YSI\..\YSI_Data\..\YSI_Internal\..\YSI_Core\..\YSI_Storage\..\YSI_Internal\..\amx\amx_header.inc(569) : warning 219: local variable "index" shadows a variable at a preceding level
/lib/include/YSI\..\YSI_Data\..\YSI_Internal\..\YSI_Core\..\YSI_Storage\..\YSI_Internal\..\amx\amx_header.inc(621) : warning 219: local variable "id" shadows a variable at a preceding level
/lib/include/YSI\..\YSI_Data\..\YSI_Internal\..\YSI_Core\..\YSI_Storage\..\YSI_Internal\..\amx\amx_header.inc(641) : warning 219: local variable "index" shadows a variable at a preceding level
/lib/include/YSI\..\YSI_Data\..\YSI_Internal\..\YSI_Core\..\YSI_Storage\..\YSI_Internal\..\amx\amx_header.inc(655) : warning 219: local variable "index" shadows a variable at a preceding level
/lib/include/YSI\..\YSI_Data\..\YSI_Internal\..\YSI_Core\..\YSI_Storage\..\YSI_Internal\..\amx\amx_header.inc(670) : warning 219: local variable "id" shadows a variable at a preceding level
/lib/include/YSI\..\YSI_Data\..\YSI_Internal\..\YSI_Core\..\YSI_Storage\..\YSI_Internal\..\amx\dynamic_call.inc(198) : warning 219: local variable "index" shadows a variable at a preceding level
/lib/include/YSI\..\YSI_Data\..\YSI_Internal\..\YSI_Core\..\YSI_Storage\..\YSI_Internal\..\amx\dynamic_call.inc(325) : warning 219: local variable "index" shadows a variable at a preceding level
/lib/include/YSI\..\YSI_Data\..\YSI_Internal\..\YSI_Core\..\YSI_Storage\..\YSI_Internal\..\amx\dynamic_call.inc(460) : warning 219: local variable "index" shadows a variable at a preceding level
/lib/include/YSI\..\YSI_Data\..\YSI_Internal\..\YSI_Core\..\YSI_Storage\..\YSI_Internal\..\amx\asm.inc(448) : warning 219: local variable "index" shadows a variable at a preceding level
/lib/include/YSI\..\YSI_Data\..\YSI_Internal\..\YSI_Core\..\YSI_Storage\..\YSI_Internal\..\amx\asm.inc(590) : warning 219: local variable "index" shadows a variable at a preceding level
/lib/include/YSI\..\YSI_Data\..\YSI_Internal\..\YSI_Core\..\YSI_Storage\..\YSI_Internal\..\amx\asm.inc(724) : warning 219: local variable "index" shadows a variable at a preceding level
/lib/include/YSI\..\YSI_Data\..\YSI_Internal\..\YSI_Core\..\YSI_Storage\..\YSI_Internal\..\amx\disasm.inc(290) : warning 219: local variable "index" shadows a variable at a preceding level
/lib/include/YSI\..\YSI_Data\..\YSI_Internal\..\YSI_Core\..\YSI_Storage\..\YSI_Internal\..\amx\disasm.inc(319) : warning 219: local variable "index" shadows a variable at a preceding level
/lib/include/YSI\..\YSI_Data\..\YSI_Internal\..\YSI_Core\..\YSI_Storage\..\YSI_Internal\..\amx\profiler.inc(107) : warning 219: local variable "index" shadows a variable at a preceding level
/lib/include/YSI\..\YSI_Data\..\YSI_Internal\..\YSI_Core\..\YSI_Storage\..\YSI_Internal\..\amx\profiler.inc(141) : warning 219: local variable "index" shadows a variable at a preceding level
/lib/include/YSI\..\YSI_Data\..\YSI_Internal\..\YSI_Core\..\YSI_Storage\y_amx.inc(908) : warning 219: local variable "index" shadows a variable at a preceding level
/lib/include/YSI\..\YSI_Data\..\YSI_Internal\..\YSI_Core\..\YSI_Storage\y_amx.inc(913) : warning 219: local variable "index" shadows a variable at a preceding level
/lib/include/YSI\..\YSI_Data\y_foreach/impl.inc(541) : warning 219: local variable "index" shadows a variable at a preceding level



/lib/include/line.inc(56) : warning 219: local variable "id" shadows a variable at a preceding level



/lib/include/GetVehicleColor.inc(90) : warning 219: local variable "index" shadows a variable at a preceding level



/lib/include/colandreas.inc(398) : error 010: invalid function or declaration
/lib/include/colandreas.inc(398) : error 055: start of function body without function header
/lib/include/colandreas.inc(400) : error 001: expected token: ";", but found "-identifier-"
/lib/include/colandreas.inc(402) : error 010: invalid function or declaration
/lib/include/colandreas.inc(405) : error 010: invalid function or declaration
/lib/include/colandreas.inc(405) : error 010: invalid function or declaration
/lib/include/colandreas.inc(405 -- 407) : error 021: symbol already defined: "id"
/lib/include/colandreas.inc(405 -- 407) : fatal error 107: too many error messages on one line

Compilation aborted.

Pawn compiler 3.10.20150531	 	 	Copyright (c) 1997-2006, ITB CompuPhase


8 Errors.
[Finished in 19.0s with exit code 1]
binnyl is offline   Reply With Quote
Old 05/12/2019, 03:04 AM   #10
binnyl
Huge Clucker
 
Join Date: Aug 2017
Posts: 257
Reputation: 6
Default Re: how to detect the pos where bomb drops?

any other include? or other version from this?
this looks bugged
binnyl is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
when i plant 2 bomb, and defuse the number 2 bomb, my bomb 1 got defused too MiyuUchiha Scripting Help 3 10/07/2017 07:59 AM
FPS Drops Warlord Client Support 4 20/10/2015 05:50 PM
[FilterScript] Bomb - seeks player continously with a nuclear bomb explosion sound! RajatPawar Filterscripts 7 24/02/2013 08:00 PM
/bomb = Activate Car Bomb DeltaAirlines12 Scripting Help 3 28/10/2012 07:09 PM
I want make the bomb . someone to stand on the spot, a bomb would work. uplovethai Help Archive 4 29/10/2009 03:19 PM


All times are GMT. The time now is 10:09 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.