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

every 10 kills get reward


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kooomax
Member
Join Date: Jan 2018
Old 01-04-2022 , 17:01   every 10 kills get reward
Reply With Quote #1

My request is like the title, how do I get a reward every 10 kills I want a code that works automatically without using something like:
PHP Code:
switch(count )
{
   case 
10//get reward
   
case 20//get reward
   
case 30//get reward
   
case 40//get reward
   
case 50//get reward

kooomax is offline
zXCaptainXz
Member
Join Date: May 2017
Old 01-04-2022 , 17:30   Re: every 10 kills get reward
Reply With Quote #2

Code:
new Kills[33]

public client_putinserver(id)
{
	Kills[id]=0;
}
public YourDeathFunction(victim, attacker)
{
	Kills[attacker]++;
	if(Kills[attacker]>10)
	{
		YourRewardFunction(attacker);
		Kills[attacker]=0;
	}
}
zXCaptainXz is offline
kooomax
Member
Join Date: Jan 2018
Old 01-04-2022 , 17:44   Re: every 10 kills get reward
Reply With Quote #3

Quote:
Originally Posted by zXCaptainXz View Post
Code:
new Kills[33]

public client_putinserver(id)
{
	Kills[id]=0;
}
public YourDeathFunction(victim, attacker)
{
	Kills[attacker]++;
	if(Kills[attacker]>10)
	{
		YourRewardFunction(attacker);
		Kills[attacker]=0;
	}
}
ops my bad, every 100 kill get reward because the kills are saved using vault so i won't the kills get reset
kooomax is offline
bigdaddy424
Senior Member
Join Date: Oct 2021
Location: Jupiter
Old 01-04-2022 , 18:46   Re: every 10 kills get reward
Reply With Quote #4

You can do something like this
Code:
new KillsFromVault[33] new NextReward[33] new ReqKills = 10 public client_putinserver(id){     NextReward[id] = KillsFromVault[id] + ReqKills } public KilledAnEnemy(id){     if (KillsFromVault[id] == NextReward[id]){         NextReward[id] += ReqKills         // award the player     } }
bigdaddy424 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-04-2022 , 18:48   Re: every 10 kills get reward
Reply With Quote #5

Code:
if(!(Kills[attacker] % 100)) {     // your code here }
__________________

Last edited by OciXCrom; 01-05-2022 at 07:05.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
kooomax
Member
Join Date: Jan 2018
Old 01-04-2022 , 19:16   Re: every 10 kills get reward
Reply With Quote #6

it's work like :
100 kill get reward
200 kill get reward
300 kill get reward
????
kooomax is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 01-05-2022 , 02:49   Re: every 10 kills get reward
Reply With Quote #7

Quote:
Originally Posted by OciXCrom View Post
Code:
if(!Kills[attacker] % 100) {     // your code here }
Code:
if(! (Kills[attacker] % 100) ) {     // your code here }

Parentheses are important for the compiler to analyze the code
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 01-05-2022 at 03:02.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Reply



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 17:48.


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