11.06.2013, 07:17
Guys i made a function for saving player stats like his x,y,z positions and more stuff but when i restart server in game via command /gmx then this function didnt save player position and player spawning in blueberry please help me here is the code for function and command gmx
pawn Код:
SStats(playerid)
{
new Float:cx,Float:cy,Float:cz,weap,ammo;
new Float:x,Float:y,Float:z,Float:armour;
GetPlayerPos(playerid, x, y, z);
GetPlayerArmour(playerid, armour);
GetPlayerWeaponData(playerid,2,weap,ammo);
dini_IntSet(Pos(playerid), "Weapon",weap);
dini_IntSet(Pos(playerid),"WeaponAmmo",ammo);
dini_IntSet(Pos(playerid),"X1",floatround(x));
dini_IntSet(Pos(playerid),"Y1",floatround(y));
dini_IntSet(Pos(playerid),"Z1",floatround(z));
GetVehiclePos(PlayerInfo[playerid][Car],cx,cy,cz);
dini_IntSet(Pos(playerid),"CarX", floatround(cx));
dini_IntSet(Pos(playerid),"CarY", floatround(cy));
dini_IntSet(Pos(playerid),"CarZ", floatround(cz));
dini_IntSet(Pos(playerid),"Armor", floatround(armour));
dini_IntSet(Pos(playerid),"CarOwner",IsOwner[playerid]);
dini_IntSet(Pos(playerid),"GL",PlayerInfo[playerid][GL]);
dini_IntSet(Pos(playerid),"FL",PlayerInfo[playerid][FL]);
dini_IntSet(Pos(playerid),"RP",PlayerInfo[playerid][RP]);
dini_IntSet(Pos(playerid),"GPS",PlayerInfo[playerid][GPS]);
dini_IntSet(Pos(playerid),"NZT",PlayerInfo[playerid][NZT]);
dini_IntSet(Pos(playerid),"Bag",PlayerInfo[playerid][Bag]);
dini_IntSet(Pos(playerid),"VIP",PlayerInfo[playerid][VIP]);
dini_IntSet(Pos(playerid),"Money",GetPlayerMoney(playerid));
dini_IntSet(Pos(playerid),"Score",GetPlayerScore(playerid));
dini_IntSet(Pos(playerid),"Job", PlayerInfo[playerid][Job]);
dini_IntSet(Pos(playerid),"Keys",PlayerInfo[playerid][Keys]);
dini_IntSet(Pos(playerid),"Cell",PlayerInfo[playerid][Cell]);
dini_IntSet(Pos(playerid),"AccNo",PlayerInfo[playerid][AccNo]);
dini_IntSet(Pos(playerid),"Bank", PlayerInfo[playerid][Bank]);
dini_IntSet(Pos(playerid),"Cigars",PlayerInfo[playerid][Cigars]);
dini_IntSet(Pos(playerid),"Interior", GetPlayerInterior(playerid));
dini_IntSet(Pos(playerid),"Teacher",PlayerInfo[playerid][Teacher]);
dini_IntSet(Pos(playerid),"Scripter",PlayerInfo[playerid][Scripter]);
dini_IntSet(Pos(playerid),"FuelCan", PlayerInfo[playerid][FuelCan]);
dini_IntSet(Pos(playerid),"HoursPlayed",PlayerInfo[playerid][Hours]);
dini_IntSet(Pos(playerid),"FStyle",GetPlayerFightingStyle(playerid));
dini_IntSet(Pos(playerid),"Passport",PlayerInfo[playerid][Passport]);
dini_IntSet(Pos(playerid),"WantedLevel",GetPlayerWantedLevel(playerid));
dini_IntSet(Pos(playerid),"Day",PlayerInfo[playerid][Day]);
dini_IntSet(Pos(playerid),"Month",PlayerInfo[playerid][Month]);
dini_IntSet(Pos(playerid),"Year",PlayerInfo[playerid][Year]);
dini_IntSet(Pos(playerid),"MinutesPlayed",PlayerInfo[playerid][Minutes]);
dini_IntSet(Pos(playerid),"AdminLevel",PlayerInfo[playerid][AdminLevel]);
dini_IntSet(Pos(playerid),"Car",GetVehicleModel(PlayerInfo[playerid][Car]));
dini_IntSet(Pos(playerid),"Clan",PlayerInfo[playerid][Clan]);
dini_IntSet(Pos(playerid),"PhoneBook",PlayerInfo[playerid][PhoneBook]);
dini_IntSet(Pos(playerid),"RepairKit",PlayerInfo[playerid][RepairKit]);
dini_IntSet(Pos(playerid),"DrivingAward",PlayerInfo[playerid][DrivingAward]);
dini_IntSet(Pos(playerid),"FlyingAward",PlayerInfo[playerid][FlyingAward]);
dini_IntSet(Pos(playerid),"MuteAward",PlayerInfo[playerid][MuteAward]);
dini_IntSet(Pos(playerid),"JobAward",PlayerInfo[playerid][JobAward]);
dini_IntSet(Pos(playerid),"VipAward",PlayerInfo[playerid][VipAward]);
dini_IntSet(Pos(playerid),"SchoolAward",PlayerInfo[playerid][SchoolAward]);
dini_IntSet(Pos(playerid),"BusinessAward",PlayerInfo[playerid][BusinessAward]);
dini_IntSet(Pos(playerid),"BankAward",PlayerInfo[playerid][BankAward]);
dini_IntSet(Pos(playerid),"AirPortAward",PlayerInfo[playerid][AirPortAward]);
dini_IntSet(Pos(playerid),"ReportAward",PlayerInfo[playerid][ReportAward]);
dini_IntSet(Pos(playerid),"JailAward",PlayerInfo[playerid][JailAward]);
dini_IntSet(Pos(playerid),"SlapAward",PlayerInfo[playerid][SlapAward]);
dini_IntSet(Pos(playerid),"SkinAward",PlayerInfo[playerid][SkinAward]);
dini_IntSet(Pos(playerid),"CigarAward",PlayerInfo[playerid][CigarAward]);
dini_IntSet(Pos(playerid),"SpeedAward",PlayerInfo[playerid][SpeedAward]);
dini_IntSet(Pos(playerid),"ClanAward",PlayerInfo[playerid][ClanAward]);
dini_IntSet(Pos(playerid),"IgnoreAward",PlayerInfo[playerid][IgnoreAward]);
dini_IntSet(Pos(playerid),"Traffic Points",PlayerInfo[playerid][TPoints]);
dini_IntSet(Pos(playerid),"Suspended License",PlayerInfo[playerid][SusL]);
dini_IntSet(Pos(playerid),"GameScore",PlayerInfo[playerid][GameScore]);
dini_IntSet(Pos(playerid),"WalkieTalkie",PlayerInfo[playerid][WalkieTalkie]);
dini_IntSet(Pos(playerid),"Frequency",PlayerInfo[playerid][Frequency]);
dini_IntSet(Pos(playerid),"BCash",PlayerInfo[playerid][BCash]);
dini_IntSet(Pos(playerid),"Watch",PlayerInfo[playerid][Watch]);
dini_IntSet(Pos(playerid),"Briefcase",PlayerInfo[playerid][Briefcase]);
dini_IntSet(Pos(playerid),"BL",PlayerInfo[playerid][BL]);
dini_IntSet(Pos(playerid),"BoL",PlayerInfo[playerid][BoL]);
dini_IntSet(Pos(playerid),"DL",PlayerInfo[playerid][DL]);
dini_IntSet(Pos(playerid),"DCP",PlayerInfo[playerid][DCP]);
dini_IntSet(Pos(playerid),"BCP",PlayerInfo[playerid][BCP]);
dini_IntSet(Pos(playerid),"BoCP",PlayerInfo[playerid][BoCP]);
dini_IntSet(Pos(playerid),"DTest",PlayerInfo[playerid][pStudent]);
dini_IntSet(Pos(playerid),"God",PlayerInfo[playerid][God]);
dini_IntSet(Pos(playerid),"GodCar",PlayerInfo[playerid][GodCar]);
dini_IntSet(Pos(playerid),"Warnings",PlayerInfo[playerid][Warnings]);
DestroyVehicle(PlayerInfo[playerid][Car]);
return 1;
}
pawn Код:
LoadStats(playerid)
{
IsOwner[playerid]=dini_Int(Pos(playerid),"CarOwner");
PlayerInfo[playerid][GL] = dini_Int(Pos(playerid),"GL");
PlayerInfo[playerid][FL] = dini_Int(Pos(playerid),"FL");
PlayerInfo[playerid][RP] = dini_Int(Pos(playerid),"RP");
SetPlayerArmour(playerid,dini_Int(Pos(playerid),"Armor"));
SetPlayerScore(playerid, dini_Int(Pos(playerid),"Score"));
PlayerInfo[playerid][GPS] = dini_Int(Pos(playerid),"GPS");
PlayerInfo[playerid][Bag] = dini_Int(Pos(playerid),"Bag");
PlayerInfo[playerid][Job] = dini_Int(Pos(playerid),"Job");
PlayerInfo[playerid][VIP] = dini_Int(Pos(playerid),"VIP");
PlayerInfo[playerid][NZT] = dini_Int(Pos(playerid),"NZT");
SetPlayerMoney(playerid, dini_Int(Pos(playerid),"Money"));
PlayerInfo[playerid][AccNo] = dini_Int(Pos(playerid),"AccNo");
PlayerInfo[playerid][Bank] = dini_Int(Pos(playerid),"Bank");
PlayerInfo[playerid][Keys] = dini_Int(Pos(playerid),"Keys");
PlayerInfo[playerid][Cell] = dini_Int(Pos(playerid),"Cell");
PlayerInfo[playerid][Cigars] = dini_Int(Pos(playerid),"Cigars");
PlayerInfo[playerid][FuelCan] = dini_Int(Pos(playerid),"FuelCan");
PlayerInfo[playerid][Hours]=dini_Int(Pos(playerid),"HoursPlayed");
PlayerInfo[playerid][Teacher] = dini_Int(Pos(playerid),"Teacher");
PlayerInfo[playerid][Scripter] = dini_Int(Pos(playerid),"Scripter");
SetPlayerFightingStyle(playerid,dini_Int(Pos(playerid),"FStyle"));
PlayerInfo[playerid][Passport] = dini_Int(Pos(playerid),"Passport");
SetPlayerWantedLevel(playerid,dini_Int(Pos(playerid),"WantedLevel"));
PlayerInfo[playerid][AdminLevel] = dini_Int(Pos(playerid),"AdminLevel");
PlayerInfo[playerid][Minutes] = dini_Int(Pos(playerid),"MinutesPlayed");
PlayerInfo[playerid][Clan] = dini_Int(Pos(playerid),"Clan");
PlayerInfo[playerid][PhoneBook] = dini_Int(Pos(playerid),"PhoneBook");
PlayerInfo[playerid][RepairKit] = dini_Int(Pos(playerid),"RepairKit");
PlayerInfo[playerid][DrivingAward] = dini_Int(Pos(playerid),"DrivingAward");
PlayerInfo[playerid][FlyingAward] = dini_Int(Pos(playerid),"FlyingAward");
PlayerInfo[playerid][MuteAward] = dini_Int(Pos(playerid),"MuteAward");
PlayerInfo[playerid][JobAward] = dini_Int(Pos(playerid),"JobAward");
PlayerInfo[playerid][VipAward] = dini_Int(Pos(playerid),"VipAward");
PlayerInfo[playerid][SchoolAward] = dini_Int(Pos(playerid),"SchoolAward");
PlayerInfo[playerid][BusinessAward] = dini_Int(Pos(playerid),"BusinessAward");
PlayerInfo[playerid][BankAward] = dini_Int(Pos(playerid),"BankAward");
PlayerInfo[playerid][AirPortAward] = dini_Int(Pos(playerid),"AirPortAward");
PlayerInfo[playerid][ReportAward] = dini_Int(Pos(playerid),"ReportAward");
PlayerInfo[playerid][JailAward] = dini_Int(Pos(playerid),"JailAward");
PlayerInfo[playerid][SlapAward] = dini_Int(Pos(playerid),"SlapAward");
PlayerInfo[playerid][SkinAward] = dini_Int(Pos(playerid),"SkinAward");
PlayerInfo[playerid][Day] = dini_Int(Pos(playerid),"Day");
PlayerInfo[playerid][Month] = dini_Int(Pos(playerid),"Month");
PlayerInfo[playerid][Year] = dini_Int(Pos(playerid),"Year");
PlayerInfo[playerid][CigarAward] = dini_Int(Pos(playerid),"CigarAward");
PlayerInfo[playerid][SpeedAward] = dini_Int(Pos(playerid),"SpeedAward");
PlayerInfo[playerid][ClanAward] = dini_Int(Pos(playerid),"ClanAward");
PlayerInfo[playerid][IgnoreAward] = dini_Int(Pos(playerid),"IgnoreAward");
PlayerInfo[playerid][TPoints] = dini_Int(Pos(playerid),"Traffic Points");
PlayerInfo[playerid][SusL] = dini_Int(Pos(playerid),"Suspended License");
PlayerInfo[playerid][GameScore] = dini_Int(Pos(playerid),"GameScore");
PlayerInfo[playerid][WalkieTalkie] = dini_Int(Pos(playerid),"WalkieTalkie");
PlayerInfo[playerid][Frequency] = dini_Int(Pos(playerid),"Frequency");
PlayerInfo[playerid][BCash] = dini_Int(Pos(playerid),"BCash");
PlayerInfo[playerid][Watch] = dini_Int(Pos(playerid),"Watch");
PlayerInfo[playerid][Briefcase] = dini_Int(Pos(playerid),"Briefcase");
PlayerInfo[playerid][BL] = dini_Int(Pos(playerid),"BL");
PlayerInfo[playerid][BoL] = dini_Int(Pos(playerid),"BoL");
PlayerInfo[playerid][DL] = dini_Int(Pos(playerid),"DL");
PlayerInfo[playerid][BCP] = dini_Int(Pos(playerid),"BCP");
PlayerInfo[playerid][BoCP] = dini_Int(Pos(playerid),"BoCP");
PlayerInfo[playerid][DCP] = dini_Int(Pos(playerid),"DCP");
PlayerInfo[playerid][pStudent] = dini_Int(Pos(playerid),"DTest");
PlayerInfo[playerid][God] = dini_Int(Pos(playerid),"God");
PlayerInfo[playerid][GodCar] = dini_Int(Pos(playerid),"GodCar");
PlayerInfo[playerid][Warnings] = dini_Int(Pos(playerid),"Warnings");
GivePlayerWeapon(playerid,dini_Int(Pos(playerid),"Weapon"),dini_Int(Pos(playerid),"WeaponAmmo"));
SpawnCar(playerid);
}
pawn Код:
dcmd_gmx(playerid,params[])
{
if(PlayerInfo[playerid][AdminLevel]!=5)return 0;
new Nam[MAX_PLAYERS],message[128],str[128];
if(sscanf(params,"s",message)) return SendClientMessage(playerid,COLOR_GREY,"USAGE: /gmx [reason]");
GetPlayerName(playerid,Nam,sizeof(Nam));
format(str,sizeof(str),"~w~Admin ~r~%s ~w~has restarted the server for ~y~%s.",Nam,message);
GameTextForAll(str, 7000,5);
for(new i=0; i<MAX_PLAYERS; i++)
{
SStats(i);
}
SendRconCommand("gmx");
return 1;
}
pawn Код:
if (dialogid == LOGIN)
{
new name[MAX_PLAYER_NAME], str1[128],string[160], tmp=dini_Int(Pos(playerid), "Password");
if(!response) return Kick(playerid);
GetPlayerName(playerid, name, sizeof(name));
format(str1, 128, "{FFFFFF}Welcome to Eclipse Roleplay Clan\n\n{DDCA22}Account:{FFFFFF} %s\n\nPlease Enter Your Password Below", name);
if (!strlen(inputtext)) return ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "Login Account",str1, "Login", "");
if(udb_hash(inputtext) == tmp)
{
LoadStats(playerid);
IsLogged[playerid] = 1;
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
SendClientMessage(playerid,0x00FFFF00, "You've successfully logged in and restored your stats!");
SetSpawnInfo(playerid,0,dini_Int(Pos(playerid),"Skin"),dini_Int(Pos(playerid), "X1"),dini_Int(Pos(playerid), "Y1"), dini_Int(Pos(playerid), "Z1"),0, 0, 0, 0, 0, 0, 0 );
SpawnPlayer(playerid);
PlayerConnect(playerid);
if(GetPlayerScore(playerid) >=1)
{
format(string,sizeof(string),"{10F441}Experience Level: {FFFFFF}%d", GetPlayerScore(playerid));
SendClientMessage(playerid, COLOR_WHITE, string);
}
else
{
format(string,sizeof(string),"{FF6347}Experience:\tNo experience at the moment.");
SendClientMessage(playerid, COLOR_WHITE, string);
}