CMD:stats(playerid, params[])
{
if(connected[playerid] == true) return GameTextForPlayer(playerid, "~r~Spawn First", 5000, 5);
new string[500],name[MAX_PLAYER_NAME], stats[1028];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "{4286f4}Name{FFFFFF}: %s\n{4286f4}Admin Level{FFFFFF}: %i\n{4286f4}Score{FFFFFF}: %i\n{4286f4}Kills{FFFFFF}: %i\n{4286f4}Deaths{FFFFFF}: %i\n{4286f4}Points{FFFFFF}: %i",name, pInfo[playerid][Admin], pInfo[playerid][Score], pInfo[playerid][Kills], pInfo[playerid][Deaths], pInfo[playerid][Points]);
format(stats, sizeof stats, "%s", string);
ShowPlayerDialog(playerid, 55, DIALOG_STYLE_MSGBOX, "Stats",stats,"Ok","");
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
pInfo[killerid][Kills] += 1;
pInfo[playerid][Deaths] += 1;
return 1;
}
public OnPlayerDeath(playerid,killerid,reason)
{
// sending the death message icon
if(IsPlayerConnected(killerid)) SendDeathMessage(killerid, playerid, reason);
// Getting the player's Health pickup
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
Health[playerid] = CreatePickup(1240,4,x,y,z+0.2,GetPlayerVirtualWorld(playerid));
SetTimerEx("Health_Timer", 15000, false, "i", playerid); // it's to destroy the pickup near the dead player's body if no one will take it. (15 seoncds)
// Kills Deaths & Ratio TD.
PlayerKills[killerid]++; // Addes a score to player killed.
PlayerDeaths[playerid]++; // Addes a score to player death.
new iString[100]; // string cells.
format(iString, sizeof iString, "Kills: %i", PlayerKills[killerid]); // Here we put the amout of Killed players.
TextDrawSetString(KILLS[killerid], iString);
format(iString, sizeof iString, "Deaths: %i", PlayerDeaths[playerid]); // Here we put the amout of Deaths.
TextDrawSetString(DEATHS[playerid], iString);
format( iString, sizeof( iString ), "Ratio: %.2f", floatdiv(PlayerKills[playerid], PlayerDeaths[playerid]));
TextDrawSetString(RATIO[playerid], iString);
// Killing spree system.
PlayerTotalKills[killerid]++;
PlayerTotalKills[playerid] = 0;
// Killing Spree on 2 killed players
if(PlayerTotalKills[killerid] == 2) {
new string[128];
new name[MAX_PLAYER_NAME];
GetPlayerName(killerid, name, sizeof(name));
format(string, sizeof(string), "{F5A9E1}(SIMPLE!) %s is on a killing spree with 2 killed players! and earns (+5 points, + 10 score +100 respect) !",name);
SendClientMessageToAll(-1, string);
format(iString, sizeof iString, "KillingSpree: %d", PlayerTotalKills[killerid]); // TD's format to the actual KillingSpree system.
TextDrawSetString(KILLINGSPREE[playerid], iString);
SetPlayerScore(killerid, GetPlayerScore(killerid) + 10);
pInfo[killerid][Score] += 10;
pInfo[killerid][Points] += 5;
pInfo[killerid][Respect] += 100;
GameTextForPlayer(playerid,"~y~+5", 500,4);
}
// Killing Spree on 4 killed players
if(PlayerTotalKills[killerid] == 4) {
new string[128];
new name[MAX_PLAYER_NAME];
GetPlayerName(killerid, name, sizeof(name));
format(string, sizeof(string), "{F5A9E1}(AMAZING!) %s is on a killing spree with 2 killed players! and earns (+10 points, + 20 score +200 respect) !",name);
SendClientMessageToAll(-1, string);
format(iString, sizeof iString, "KillingSpree: %d", PlayerTotalKills[killerid]); // TD's format to the actual KillingSpree system.
TextDrawSetString(KILLINGSPREE[playerid], iString);
SetPlayerScore(killerid, GetPlayerScore(killerid) + 20);
pInfo[killerid][Score] += 20;
pInfo[killerid][Points] += 10;
pInfo[killerid][Respect] += 200;
GameTextForPlayer(playerid,"~y~+10", 500,4);
}
// Killing Spree on 8 killed players
if(PlayerTotalKills[killerid] == 8) {
new string[128];
new name[MAX_PLAYER_NAME];
GetPlayerName(killerid, name, sizeof(name));
format(string, sizeof(string), "{F5A9E1}(JACKER!) %s is on a killing spree with 2 killed players! and earns (+15 points, + 30 score +300 respect) !",name);
SendClientMessageToAll(-1, string);
format(iString, sizeof iString, "KillingSpree: %i", PlayerTotalKills[killerid]); // TD's format to the actual KillingSpree system.
TextDrawSetString(KILLINGSPREE[killerid], iString);
SetPlayerScore(killerid, GetPlayerScore(killerid) + 30);
pInfo[killerid][Score] += 30;
pInfo[killerid][Points] += 15;
pInfo[killerid][Respect] += 300;
GameTextForPlayer(killerid,"~y~+15", 500,4);
}
// Killing Spree on 12 killed players
if(PlayerTotalKills[killerid] == 12) {
new string[128];
new name[MAX_PLAYER_NAME];
GetPlayerName(killerid, name, sizeof(name));
format(string, sizeof(string), "{F5A9E1}(WANTED!) %s is on a killing spree with 2 killed players! and earns (+20 points, + 40 score +400 respect) !",name);
SendClientMessageToAll(-1, string);
format(iString, sizeof iString, "KillingSpree: %i", PlayerTotalKills[killerid]); // TD's format to the actual KillingSpree system.
TextDrawSetString(KILLINGSPREE[killerid], iString);
SetPlayerScore(killerid, GetPlayerScore(killerid) + 40);
pInfo[killerid][Score] += 40;
pInfo[killerid][Points] += 20;
pInfo[killerid][Respect] += 400;
GameTextForPlayer(killerid,"~y~+20", 500,4);
}
// If player kills someone he will be awarded with +1 point level and +50 respect
SendClientMessage(killerid, -1,"{9FF781}* Player killed! and awarded with (+1 point level, +15 score and +50 respect) !");
SendClientMessage(killerid, -1,"{D8D8D8}(INFO) You earned +50 respect !");
pInfo[killerid][Points] += 1;
pInfo[killerid][Respect] += 50;
SetPlayerScore(killerid, GetPlayerScore(killerid) + 15);
pInfo[killerid][Score] += 15;
GameTextForPlayer(killerid,"~y~+15", 400,4);
// If player die he will lose -5 points and -20 respect
SendClientMessage(playerid, -1,"{FA5858}* You got killed! and suddenly lost (-3 points, -5 score and -20 respect lost) !");
SendClientMessage(playerid, -1,"{D8D8D8}(INFO) You lost -20 respect !");
pInfo[playerid][Points] -= 3;
pInfo[playerid][Respect] += -20;
SetPlayerScore(playerid, GetPlayerScore(playerid) - 5);
GameTextForPlayer(playerid,"~r~-5", 400,4);
pInfo[playerid][Score] -= 5;
// Saving kills and deaths on player's config file.
if(killerid != INVALID_PLAYER_ID) // Checking if the killer of the player is valid.
{
//Increasing the kills of the killer and the deaths of the player.
pInfo[killerid][Kills]++;
pInfo[playerid][Deaths]++;
}
if(IsBeingSpectated[playerid] == 1)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(spectarget[i] == playerid)
{
TogglePlayerSpectating(i, false);
}
}
}
return 1;
}
CMD:stats(playerid, params[])
{
if(connected[playerid] == true) return GameTextForPlayer(playerid, "~r~Spawn First", 5000, 5);
new string[256], stats[256], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "{4286f4}Name{FFFFFF}: %s\n", name);
format(stats, string);
format(string, sizeof(string), "{4286f4}Admin Level{FFFFFF}: %i\n", pInfo[playerid][Admin]);
format(stats, string);
format(string, sizeof(string), "{4286f4}Score{FFFFFF}: %i\n", pInfo[playerid][Score]);
format(stats, string);
format(string, sizeof(string), "{4286f4}Kills{FFFFFF}: %i\n", PlayerKills[playerid]);
format(stats, string);
format(string, sizeof(string), "{4286f4}Deaths:{FFFFFF}: %i\n", PlayerDeaths[playerid]);
format(stats, string);
format(string, sizeof(string), "{4286f4}Points:{FFFFFF}: %i\n", pInfo[playerid][Points]);
format(stats, string);
ShowPlayerDialog(playerid, 55, DIALOG_STYLE_MSGBOX, "Stats", stats, "Ok", "");
return 1;
}
|
PHP код:
|
CMD:woo( playerid, params[] ) {
new szPrimaryStr[ 600 ], szSubStr[ 128 ];
format( szSubStr, sizeof szSubStr, "My player ID is : %i\n", playerid );
strcat( szPrimaryStr, szSubStr );
return 1;
}
if( killerid != INVALID_PLAYER_ID ) {
gPlayerKills[ killerid ] ++;
}