SA-MP Forums

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

Thread Tools Display Modes
Old 08/02/2017, 09:59 PM   #1
Huge Clucker
aoky's Avatar
Join Date: Oct 2016
Location: Czech Republic
Posts: 488
Reputation: 136
Default Is Player Alive

Hey guys! Is there anyway to check if a player is alive? In my current script when a player gets hit by a dildo, he gets put into spectate mode. He spectates the person with the dildo(AKA Slapper), so I'd want to know if it's possible to make a textdraw to say how much players are alive. I would appreciate any help!

TLR: Is there anyway to make a textdraw to say "Fappers alive: X". When a player gets hit by a dildo he spectates the Slapper. Thank you!
owner/developer @ koky's deathmatch
aoky is offline   Reply With Quote
Old 08/02/2017, 10:03 PM   #2
Spam Machine
Vince's Avatar
Join Date: Sep 2007
Location: Belgium
Posts: 10,083
Reputation: 2655
Default Re: Is Player Alive

Option 1: use a custom foreach iterator to store alive players and then use Iter_Count. Option 2: do a manual loop over all the players and increment a counter if the state of the player is not "wasted" or "spectating".
Vince is offline   Reply With Quote
Old 19/05/2017, 07:49 PM   #3
Join Date: Jan 2017
Posts: 293
Reputation: 28
Default Re: Is Player Alive

PHP Code:
new Alive 0;

Alive++; // if you want to set player as alive when he joins
    else if(
// use Alive variable in textdraw ^^ 

Last edited by YouHack; 20/05/2017 at 11:33 AM.
YouHack is offline   Reply With Quote
Old 20/05/2017, 01:42 AM   #4
Big Clucker
CheezIt's Avatar
Join Date: Apr 2017
Posts: 181
Reputation: 17
Default Re: Is Player Alive

Have a global variable, and when the player joins the event or spawns increase the variable by 1. When a player leaves the event or gets slapped, decrease the variable. Simple as that.
I'd like to bring back my old CNR server that was created from scratch & hosted years ago. I'll host & update everything (including the website & forum). You would pay for hosted tab and help manage the community. PM me if you're interested!
CheezIt is offline   Reply With Quote

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
Last Player Alive aoky Scripting Help 2 08/02/2017 04:01 PM
Is Player Alive ? Champ Scripting Help 13 20/06/2013 07:54 PM
How to count the last player alive in a mission? ZamaXor Help Archive 2 06/11/2010 03:21 PM
Keeping a player and a car alive. Sinner Help Archive 3 11/10/2010 11:50 AM
Detect if player is alive or dead? -Rebel Son- Help Archive 9 10/04/2010 05:21 AM

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

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