AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Individual count++ (personal) for each player (https://forums.alliedmods.net/showthread.php?t=323511)

delux450 04-21-2020 09:04

Individual count++ (personal) for each player
 
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" :nono:

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

Thanks for help :wink:

Nexd 04-21-2020 09:20

Re: Individual count++ (personal) for each player
 
int count[MAXPLAYERS+1];
count[client]++;

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

delux450 04-21-2020 10:24

Re: Individual count++ (personal) for each player
 
Quote:

Originally Posted by Nexd (Post 2695058)
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' :wink:


All times are GMT -4. The time now is 12:23.

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