Posts: 176
Threads: 26
Joined: Jun 2016
Reputation:
0
hi everyone,
I am using a yini score kills death save system. i was in need of a k/d ratio system i readed a lot from wiki but get no luck.
can someone help?
I Want the same thing,i heard u got to divide the kills and deaths
Like Kills % Deaths
Posts: 596
Threads: 75
Joined: Nov 2015
Note: This is an example code
Код:
//Include zcmd for making easy commands
#include <zcmd>
//Global Variables
new Kills[MAX_PLAYERS];
new Deaths[MAX_PLAYERS];
public OnPlayerDeath(playerid, killerid, reason)
{
//Put this code under OnPlayerDeath()
if(killerid != INVALID_PLAYER_ID)
{
Kills[killerid]++;
}
Deaths[playerid]++;
return 1;
}
public OnPlayerDisconnect(playerid)
{
//Code under OnPlayerDeath
Kills[playerid] = 0;
Deaths[playerid] = 0;
return 1;
}
CMD:kdratio(playerid, params[])
{
new str[50];
format(str, sizeof(str), "You K/D Ratio: %f", floatdiv(Kills[playerid], Deaths[playerid]));
SendClientMessage(playerid, 0xFFFFFFFF, str);
return 1;
}