SA-MP Forums Archive
shoot in RangeOfPoint - 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: shoot in RangeOfPoint (/showthread.php?tid=566679)



shoot in RangeOfPoint - s3ek - 07.03.2015

if player shoot in RangeOfPoint(playerid,110.0,-1489.6556, 751.8200, 7.2345))

player get killed because shooted in this range point

help me to make it
PHP код:
public OnPlayerUpdate(playerid)
{
    if(!
IsPlayerConnected(playerid)) return 0;
    
// No weapons in interiors
    
if(GetPlayerInterior(playerid) != && GetPlayerWeapon(playerid) != 0) {
        
SetPlayerArmedWeapon(playerid,0); // fists
        
return 0// no syncing until they change their weapon
    
}
    if(
IsPlayerInRangeOfPoint(playerid,110.0,-1489.6556751.82007.2345))
    {
            if(!
GetPVarInt(playerid,"spawn")) // we are looking if there as variable with the name 'spawn' present , which we havent created yet
            
{
                
SetPVarInt(playerid,"spawn",1); // since there wasnt , we now create it so that the loop doesnt enter this again n again and create 'lag'
                
PlayAudioStreamForPlayer(playerid,"http://somafm.com/tags.pls",-1489.6556751.82007.2345,110.0,1);
            }
    }
    else 
// player is not in point range
    
{
        if(
GetPVarInt(playerid,"spawn")) // since we create it before and played the stream , it will be there
        
{
            
DeletePVar(playerid,"spawn");// delete the variable so that next time player goes in range the radio can be started again
               
StopAudioStreamForPlayer(playerid);
        }
    }
    return 
1;




Re: shoot in RangeOfPoint - ATGOggy - 07.03.2015

PHP код:
public OnPlayerWeaponShot(playeridweaponidhittypehitidFloat:fXFloat:fYFloat:fZ)
{
    if(
IsPlayerInRangeOfPoint(playerid,110.0,-1489.6556751.82007.2345))
    {
         
SetPlayerHealth(playerid0.0);
    }
    return 
1;




Re: shoot in RangeOfPoint - s3ek - 07.03.2015

Quote:
Originally Posted by ATGOggy
Посмотреть сообщение
PHP код:
public OnPlayerWeaponShot(playeridweaponidhittypehitidFloat:fXFloat:fYFloat:fZ)
{
    if(
IsPlayerInRangeOfPoint(playerid,110.0,-1489.6556751.82007.2345))
    {
         
SetPlayerHealth(playerid0.0);
    }
    return 
1;

not work + get warning
Код:
warning 235: public function lacks forward declaration (symbol "OnPlayerWeaponShot")



Re: shoot in RangeOfPoint - Abagail - 07.03.2015

It's not working because you're not using 0.3z or above. You need to use 0.3z for that callback to work. Additionally, 110.0 is a VERY high range are you sure you want to use such a big radius?


Re: shoot in RangeOfPoint - s3ek - 07.03.2015

Quote:
Originally Posted by Abagail
Посмотреть сообщение
It's not working because you're not using 0.3z or above. You need to use 0.3z for that callback to work. Additionally, 110.0 is a VERY high range are you sure you want to use such a big radius?
just test , iwil use if(IsPlayerInRangeOfPoint(playerid,15.0,-1489.6556, 751.8200, 7.2345))


Respuesta: shoot in RangeOfPoint - JuanStone - 07.03.2015

Quote:
Originally Posted by Wiki-samp
Посмотреть сообщение
This callback was added in SA-MP 0.3z and will not work in earlier versions!
You must use version 0.3z or greater in order to use this, you could fix that by adding a "forward name" but would not call.

You could also try with this:

In 0.3z or news versions-.

PHP код:
public OnPlayerGiveDamage(playeriddamagedidFloatamountweaponidbodypart)
{
    if(
IsPlayerInRangeOfPoint(playerid110.0,-1489.6556751.82007.2345))
    {
        
SetPlayerHealth(playerid0.0);
    }
    return 
true;

In minor versions to 0.3z(0.3x.. -).

PHP код:
public OnPlayerGiveDamage(playeriddamagedidFloatamountweaponid)
{
    if(
IsPlayerInRangeOfPoint(playerid110.0,-1489.6556751.82007.2345))
    {
        
SetPlayerHealth(playerid0.0);
    }
    return 
true;




Re: shoot in RangeOfPoint - s3ek - 07.03.2015

Quote:
Originally Posted by ATGOggy
Посмотреть сообщение
PHP код:
public OnPlayerWeaponShot(playeridweaponidhittypehitidFloat:fXFloat:fYFloat:fZ)
{
    if(
IsPlayerInRangeOfPoint(playerid,110.0,-1489.6556751.82007.2345))
    {
         
SetPlayerHealth(playerid0.0);
    }
    return 
1;

it work in samp 0.3z , but i want solution or method working in 0.3x like: cannot use weapon in Range Of Point

pleas help me guys


Re: shoot in RangeOfPoint - s3ek - 07.03.2015

up up up?


Respuesta: shoot in RangeOfPoint - JuanStone - 08.03.2015

What You attempt with codes that allow previously ?.

This should work on any version.

PHP код:
public OnPlayerTakeDamage(playeridissueridFloatamountweaponid)
{
    if(
issuerid != INVALID_PLAYER_ID)
    {
        if(
IsPlayerInRangeOfPoint(issuerid110.0,-1489.6556751.82007.2345))
        {
            
SetPlayerHealth(issuerid0.00);
            
SetPlayerArmour(issuerid0.00);
        }
    }
    return 
true;

Quote:
Originally Posted by [Bios]Marcel
Посмотреть сообщение
This callback was added in SA-MP 0.3d and will not work in earlier versions!
Quote:
Originally Posted by s3ek
Посмотреть сообщение
it work in samp 0.3z , but i want solution or method working in 0.3x like:
Nobody uses that version, I was referring to the latest versions(zx). What do you think that someone would use a version ?.


AW: Respuesta: shoot in RangeOfPoint - BiosMarcel - 08.03.2015

Quote:
Originally Posted by JuanStone
Посмотреть сообщение
What You attempt with codes that allow previously ?.

This should work on any version.

PHP код:
public OnPlayerTakeDamage(playeridissueridFloatamountweaponid)
{
    if(
issuerid != INVALID_PLAYER_ID)
    {
        if(
IsPlayerInRangeOfPoint(issuerid110.0,-1489.6556751.82007.2345))
        {
            
SetPlayerHealth(issuerid0.00);
            
SetPlayerArmour(issuerid0.00);
        }
    }
    return 
true;

This callback was added in SA-MP 0.3d and will not work in earlier versions!