26.06.2016, 21:41
Quote:
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; } |