Raised This Month: $12 Target: $400
 3% 

Individual count++ (personal) for each player


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
delux450
Junior Member
Join Date: Apr 2020
Old 04-21-2020 , 09:04   Individual count++ (personal) for each player
Reply With Quote #1

Hi guys,

i'm bulding a plugin when player is in game he can hade 3 "he grenade", so, when the player launche the first grenade, i increment a "count" variable like this :
PHP Code:
count++; 
and i put a new grenade in stuff (if count != 3)

All working fine, but when other player launch grenade he increment count too...

i want to increment "count" only by one player, instead by "all"

Is not a really a probleme, it's logic, but how to do thate ? i don't have any idea

Thanks for help
delux450 is offline
Nexd
BANNED
Join Date: Dec 2013
Location: Hungary
Old 04-21-2020 , 09:20   Re: Individual count++ (personal) for each player
Reply With Quote #2

int count[MAXPLAYERS+1];
count[client]++;

dont forget to reset the variable somewhere like
for(int i = 1; i <= MaxClients; i++) count[i] = 0;
Nexd is offline
delux450
Junior Member
Join Date: Apr 2020
Old 04-21-2020 , 10:24   Re: Individual count++ (personal) for each player
Reply With Quote #3

Quote:
Originally Posted by Nexd View Post
int count[MAXPLAYERS+1];
count[client]++;

dont forget to reset the variable somewhere like
for(int i = 1; i <= MaxClients; i++) count[i] = 0;
Hello nexd, thanks for solution

The variable it was reseted at Event_PlayerSpawn
PHP Code:
public Event_PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast) {
i_he_grenade 0;
...
...
...

Thanks dude, i'll try and if is good, i change to 'solved'
delux450 is offline
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

Forum Jump


All times are GMT -4. The time now is 11:20.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode