18.04.2014, 19:31
OnPlayerDisconnect Callback:
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
new Float:armour,Float:health;
new vehicleid = GetPlayerVehicleID(playerid);
GetPlayerPos(playerid, PX[playerid], PY[playerid], PZ[playerid]);
GetPlayerName(playerid, pname, sizeof(pname)); // This get's the player name with the name length
format(file, sizeof(file), savefolder,pname); // Formatting file
if(!dini_Exists(file)) { // If the file exist
}
else {
dini_IntSet(file, "Armour", GetPlayerArmour(playerid, armour)); // Set's "Money"
dini_IntSet(file, "Cash", GetPlayerMoney(playerid)); // Set's "Money"
dini_IntSet(file, "Health", GetPlayerHealth(playerid, health)); // Set's "Money"
dini_IntSet(file, "Score", GetPlayerScore(playerid)); // Set's "Money"
dini_IntSet(file, "WantedLevel", GetPlayerWantedLevel(playerid)); // Set's "Money"
dini_IntSet(file, "RacesWon", playerinfo[playerid][RacesWon]); // Set's "Money"
dini_IntSet(file, "RacesLost", playerinfo[playerid][RacesLost]); // Set's "Money"
dini_IntSet(file, "Evaded", playerinfo[playerid][Evaded]); // Set's "Money"
dini_IntSet(file, "Busted", playerinfo[playerid][Busted]); // Set's "Money"
dini_IntSet(file, "AdminLevel", playerinfo[playerid][AdminLevel]); // Set's "Money"
dini_IntSet(file, "Banned", playerinfo[playerid][Banned]); // Set's "Money"
dini_IntSet(file, "Disabled", playerinfo[playerid][Disabled]); // Set's "Money"
dini_IntSet(file, "Challenges", playerinfo[playerid][Challenges]); // Set's "Money" // if not
}
if(IsPlayerInAnyVehicle(playerid))
{
dini_IntSet(file, "VehicleID", vehicleid); // Set's "Score"
dini_IntSet(file, "ModelID", GetVehicleModel(vehicleid)); // Set's "Money"
}
GetPlayerName(playerid, pname, sizeof(pname)); // This get's the player name with the lenght of the player name
format(file2, sizeof(file2), savefolder2,pname); // This describe's where to save and how to save it
if(!dini_Exists(file2)) { // If the file exist
}
else {
dini_FloatSet(file2, "PositionX", PX[playerid]); // Set's "Score"
dini_FloatSet(file2, "PositionY", PY[playerid]); // Set's "Score"
dini_FloatSet(file2, "PositionZ", PZ[playerid]); // Set's "Score"
}
return 1;
}