27.04.2012, 21:33
Does anyone know what the integers you can use for GetPVarInt are?
public OnPlayerDeath(playerid, killerid, reason)
{
// We check if killerid is a valid player id and give him one kill
if(killerid != INVALID_PLAYER_ID)
SetPVarInt(playerid, "Kills", GetPVarInt(playerid, "Kills") + 1);
SetPVarInt(playerid, "Deaths", GetPVarInt(playerid, "Deaths") + 1); // Here we set a variable called "Deaths" to the player who died
return 1;
}
// We create a command that resets a player kills
YCMD:resetkills(playerid, params[], help)
{
#pragma unused help, params
DeletePVar(playerid, "Kills");
return 1;
}
// A command that resets deaths
YCMD:resetdeaths(playerid, params[], help)
{
#pragma unused help, params
DeletePVar(playerid, "Deaths");
return 1;
}
// A command to check kills and deaths:
YCMD:checkstats(playerid, params[], help)
{
#pragma unused help, params
new str[128];
format(str, sizeof str, "You have %i kills and %i deaths.", GetPVarInt(playerid, "Kills"), GetPVarInt(playerid, "Deaths"))
SendClientMessage(playerid, -1, str);
return 1;
}