Need help K/D Ratio
#9

Quote:
Originally Posted by K0P
Посмотреть сообщение
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;
}
ty sir for your kind help.
Reply


Messages In This Thread
Need help K/D Ratio - by Owen007 - 26.06.2016, 21:00
Re: Need help K/D Ratio - by WhiteGhost - 26.06.2016, 21:05
Re: Need help K/D Ratio - by Konstantinos - 26.06.2016, 21:08
Re: Need help K/D Ratio - by Owen007 - 26.06.2016, 21:17
Re: Need help K/D Ratio - by WhiteGhost - 26.06.2016, 21:18
Re: Need help K/D Ratio - by DRIFT_HUNTER - 26.06.2016, 21:21
Re: Need help K/D Ratio - by Owen007 - 26.06.2016, 21:29
Re: Need help K/D Ratio - by K0P - 26.06.2016, 21:37
Re: Need help K/D Ratio - by Owen007 - 26.06.2016, 21:41
Re: Need help K/D Ratio - by Dayrion - 27.06.2016, 02:02

Forum Jump:


Users browsing this thread: 1 Guest(s)