SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 30/01/2015, 12:11 AM   #1
PrinceOfPersia
Huge Clucker
 
PrinceOfPersia's Avatar
 
Join Date: Oct 2013
Location: Egypt
Posts: 348
Reputation: 35
Default One shot one kill by sniper.

So yea, I wanted to make the sniper kills someone from 1 shot.

Can anyone help me?
PrinceOfPersia is offline   Reply With Quote
Old 30/01/2015, 12:15 AM   #2
StreetGT
Banned
 
Join Date: Dec 2008
Location: Portugal
Posts: 1,033
Reputation: 108
Default Re: One shot one kill by sniper.

have you ever tried to read wiki from sa-mp?
StreetGT is offline   Reply With Quote
Old 30/01/2015, 12:17 AM   #3
Schneider
Gangsta
 
Schneider's Avatar
 
Join Date: Jun 2007
Location: Netherlands
Posts: 515
Reputation: 136
Default Re: One shot one kill by sniper.

Here you go, but you could have easily figured this out yourself If you would have searched..
pawn Code:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
    if(weaponid == 34)
    {
        SetPlayerHealth(playerid, 0.0);
    }
    return 1;
}
__________________
My Releases:
- Keep your Lane (Ghost- & Traintrack-driving detector).
- Lottery/Keno (Gambling Minigame)
Schneider is offline   Reply With Quote
Old 30/01/2015, 12:28 AM   #4
PrinceOfPersia
Huge Clucker
 
PrinceOfPersia's Avatar
 
Join Date: Oct 2013
Location: Egypt
Posts: 348
Reputation: 35
Default Re: One shot one kill by sniper.

Thank you guys.
PrinceOfPersia is offline   Reply With Quote
Old 30/01/2015, 01:40 AM   #5
Abagail
High-roller
 
Join Date: Dec 2013
Location: GetPlayerPos(playerid, pos); Scripter/Mapper.
Posts: 3,140
Reputation: 445
Default Re: One shot one kill by sniper.

Quote:
Originally Posted by Schneider View Post
Here you go, but you could have easily figured this out yourself If you would have searched..
pawn Code:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
    if(weaponid == 34)
    {
        SetPlayerHealth(playerid, 0.0);
    }
    return 1;
}
I'd recommend peforming IsPlayerConnected checks, aswell as making sure playerid, and issuerid are different. Some SA:MP functions crash if a bad player ID is given, which can cause a server crash, thus causing an exploit within your server. Just a FYI thing, though, SetPlayerHealth shouldn't crash to my knowledge if an invalid player ID is passed through.
Abagail 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
Help Head Shot with sniper Mijata Scripting Help 24 20/02/2015 05:12 PM
Can you give me some Biz Script and One Shot Kill of Sniper like Scope Lloyde Scripting Help 1 07/11/2013 03:57 AM
[Include] Sniper - One Shot, One Kill | SA-MP 0.3d RC2 ONLY! Flyfishes Includes 20 04/02/2012 02:57 PM
One Sniper shot = one kill LZLo Help Archive 4 18/02/2011 04:38 PM


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


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