floatdiv(KILLS_HERE, DEATHS_HERE)
|
pawn Код:
|
can u make the thing wut u saying.
new str[24];
format(str, sizeof(str), "Ratio %f", (pInfo[playerid][Kills]/pInfo[playerid][Deaths]));
SendClientMessage(playerid, -1, str);
|
pawn Код:
|
//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;
}
|
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;
}
|
if(PlayerDMStats[playerid][dmDeath] == 0) format(str1, sizeof(str1), RED_U"- "WHITE_U"Ratio : "BLUE_U"None\n");
else format(str1, sizeof(str1), RED_U"- "WHITE_U"Ratio : "BLUE_U"%0.2f\n", floatdiv(PlayerDMStats[playerid][dmKills],PlayerDMStats[playerid][dmDeath]));