Simple Headshot Script

Scripter or interested in scripting? This place just may fancy to your likings!

Moderators: FM, Game Admins, Lead Admins

Post Reply
User avatar
jawni
Gangster
Gangster
Posts: 93
Joined: Thu Jun 09, 2016 11:23 pm

Simple Headshot Script

Post by jawni » Fri Jul 29, 2016 8:19 pm

I was bored so I made this, It is very simple. When you get hit in the head, you die instantly and the killer gets $400.




I'm still newbie in Pawno and this field, so uh thanks!
Private message me If you need any help.

User avatar
白衣渡川
Gangster
Gangster
Posts: 131
Joined: Fri May 01, 2015 5:29 am

Re: Simple Headshot Script

Post by 白衣渡川 » Fri Jul 29, 2016 11:10 pm

jawni wrote:I was bored so I made this, It is very simple. When you get hit in the head, you die instantly and the killer gets $400.




I'm still newbie in Pawno and this field, so uh thanks!

good start,you can add some effect like when he get headshot the screen turns red or something

User avatar
jawni
Gangster
Gangster
Posts: 93
Joined: Thu Jun 09, 2016 11:23 pm

Re: Simple Headshot Script

Post by jawni » Fri Jul 29, 2016 11:47 pm

白衣渡川 wrote:
jawni wrote:I was bored so I made this, It is very simple. When you get hit in the head, you die instantly and the killer gets $400.




I'm still newbie in Pawno and this field, so uh thanks!

good start,you can add some effect like when he get headshot the screen turns red or something



Yeah, good idea! I will work on that.
Private message me If you need any help.

User avatar
白衣渡川
Gangster
Gangster
Posts: 131
Joined: Fri May 01, 2015 5:29 am

Re: Simple Headshot Script

Post by 白衣渡川 » Sun Jul 31, 2016 5:21 am

jawni wrote:
白衣渡川 wrote:
jawni wrote:I was bored so I made this, It is very simple. When you get hit in the head, you die instantly and the killer gets $400.




I'm still newbie in Pawno and this field, so uh thanks!

good start,you can add some effect like when he get headshot the screen turns red or something



Yeah, good idea! I will work on that.

hp has no effect, just setplayerhealth 0

User avatar
Kevins
- Silver Member -
- Silver Member -
Posts: 234
Joined: Thu Sep 08, 2011 6:22 pm
Ingame name: Kevin Eisenberg
Location: Europe
Contact:

Re: Simple Headshot Script

Post by Kevins » Tue Aug 02, 2016 5:38 pm

You didn't set anything to HP. You could have done SetPlayerHealth(playerid, 0); instead. Nice script though!

User avatar
jawni
Gangster
Gangster
Posts: 93
Joined: Thu Jun 09, 2016 11:23 pm

Re: Simple Headshot Script

Post by jawni » Tue Aug 02, 2016 8:46 pm

Kevins wrote:You didn't set anything to HP. You could have done SetPlayerHealth(playerid, 0); instead. Nice script though!

No need to mention to that, because someone did already. Thanks!
Private message me If you need any help.

User avatar
Private200
Silver Member
Silver Member
Posts: 117
Joined: Thu Feb 11, 2016 10:34 pm

Re: Simple Headshot Script

Post by Private200 » Sat Aug 06, 2016 2:25 pm

jawni wrote:
Kevins wrote:You didn't set anything to HP. You could have done SetPlayerHealth(playerid, 0); instead. Nice script though!

No need to mention to that, because someone did already. Thanks!
It's a good system and what you've done there isn't wrong. When you first created that variable "HP", you didn't give it any value therefore default value would be 0. You're now setting the player health to HP-100, which is 0 - 100. Player health will be -100 in the end. If you'd remove that -100, it would be SetPlayerHealth(playerid, HP);, same as setting the player health to 0, as already mentioned by two or three others before me.

Your code is not wrong at all, it's just the long way of doing things.

User avatar
OPZ
Silver Member
Silver Member
Posts: 64
Joined: Sun Jun 19, 2016 11:38 pm
Location: Canada
Contact:

Re: Simple Headshot Script

Post by OPZ » Wed Aug 10, 2016 4:32 am

This looks good so far, however I don't understand why the shooter would get $400? Is this theoretically based around a dm/tdm script?
Image
W E B D E V E L O P E R
my projects
LS-RP Archive (in development)


Image
Image

User avatar
EldarCoox
Mafia
Mafia
Posts: 468
Joined: Sun Jul 21, 2013 9:44 pm
Ingame name: Ace

Re: Simple Headshot Script

Post by EldarCoox » Mon Jan 09, 2017 9:29 pm

Private200 wrote:
jawni wrote:
Kevins wrote:You didn't set anything to HP. You could have done SetPlayerHealth(playerid, 0); instead. Nice script though!

No need to mention to that, because someone did already. Thanks!
It's a good system and what you've done there isn't wrong. When you first created that variable "HP", you didn't give it any value therefore default value would be 0. You're now setting the player health to HP-100, which is 0 - 100. Player health will be -100 in the end. If you'd remove that -100, it would be SetPlayerHealth(playerid, HP);, same as setting the player health to 0, as already mentioned by two or three others before me.

Your code is not wrong at all, it's just the long way of doing things.
Just make a simple stock like this:

Code: Select all

forward KillPlayer(playerid);
stock KillPlayer(playerid)
{
     SetPlayerHealth(playerid, 0);
     return 1;// or don't put return i'm not sure i didn't scripted a while..
}

You should put in a PlaySound as well, or if you are trying to make a RP script do it without giving any money and making some limitations like: 2-3 gsw with colt then kills him or like that, play around with it its fun !

Post Reply

Return to “Scripting Section”

Who is online

Users browsing this forum: No registered users and 2 guests