v OnPlayerSpawn to mam takto skúsal som to aj inak aj cez podmienku či už existuje ale stale mi to nešlo.. (Deathreset mám ked zomrie aby sa vyresetovali zbrane lebo zozaciatku mi to išlo ale pri umrti mi zbrane stale čítali zo súboru že ich stale mam)
Potom ešte v registracii mam aby sa vytvorilo v zlozle "Zbran1 - (hodnota) , zbran1naboje - (hodnota)
Ale ukladanie do súboru mi funguje lebo ked pridem na server a cez prikaz si vlozim .. - Boxer,basbalku a desert eagle.. a odhlasim sa ukazuje mi to takto
Dotaz
MrShoTys74 1
Zdravim Chalani vedel by mi niekto pomôct s načítanim zbrani ? .. ukladanie mi funguje ale nechce mi ich načítať ked sa spawnem.
enum pInfo
{
pPass,
pCash,
pAdmin,
pKills,
pDeaths,
pWanted,
pSkin,
pVodickyB,
pVodickyC,
pZbran0,
pZbran0naboje,
pZbran1,
pZbran1naboje,
pZbran2,
pZbran2naboje
}
public LoadUser_data(playerid,name[],value[])
{
INI_Int("Password",PlayerInfo[playerid][pPass]);
INI_Int("Cash",PlayerInfo[playerid][pCash]);
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
INI_Int("Kills",PlayerInfo[playerid][pKills]);
INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
INI_Int("Wanted",PlayerInfo[playerid][pWanted]);
INI_Int("Skin",PlayerInfo[playerid][pSkin]);
INI_Int("VodickyB",PlayerInfo[playerid][pVodickyB]);
INI_Int("VodickyC",PlayerInfo[playerid][pVodickyC]);
INI_Int("pZbran1",PlayerInfo[playerid][pZbran1]);
INI_Int("pZbran1naboje",PlayerInfo[playerid][pZbran1naboje]);
INI_Int("pZbran0",PlayerInfo[playerid][pZbran0]);
INI_Int("pZbran0naboje",PlayerInfo[playerid][pZbran0naboje]);
INI_Int("pZbran2",PlayerInfo[playerid][pZbran2]);
INI_Int("pZbran2naboje",PlayerInfo[playerid][pZbran2naboje]);
INI_Int("pSekundy",pSekundy[playerid]);
INI_Int("pMinuty",pMinuty[playerid]);
INI_Int("pHodiny",pHodiny[playerid]);
return 1;
}
v OnPlayerConnect resetujem dáta ak sa prihlási nový uživatel..
PlayerInfo[playerid][pDeaths] = 0;
PlayerInfo[playerid][pAdmin] = 0;
PlayerInfo[playerid][pCash] = 0;
PlayerInfo[playerid][pKills] = 0;
PlayerInfo[playerid][pSkin] = 0;
PlayerInfo[playerid][pWanted] = 0;
PlayerInfo[playerid][pVodickyB] = 0;
PlayerInfo[playerid][pVodickyC] = 0;
PlayerInfo[playerid][pZbran0] = 0;
PlayerInfo[playerid][pZbran0naboje] = 0;
PlayerInfo[playerid][pZbran1] = 0;
PlayerInfo[playerid][pZbran1naboje] = 0;
PlayerInfo[playerid][pZbran2] = 0;
PlayerInfo[playerid][pZbran2naboje] = 0;
pSekundy[playerid] = 0;
pMinuty[playerid] = 0;
pHodiny[playerid] = 0;
v OnPlayerSpawn to mam takto skúsal som to aj inak aj cez podmienku či už existuje ale stale mi to nešlo.. (Deathreset mám ked zomrie aby sa vyresetovali zbrane lebo zozaciatku mi to išlo ale pri umrti mi zbrane stale čítali zo súboru že ich stale mam)
public OnPlayerSpawn(playerid)
{
if(Deathreset[playerid] == 1)
{
PlayerInfo[playerid][pZbran0] = 0;
PlayerInfo[playerid][pZbran0naboje] = 0;
PlayerInfo[playerid][pZbran1] = 0;
PlayerInfo[playerid][pZbran1naboje] = 0;
PlayerInfo[playerid][pZbran2] = 0;
PlayerInfo[playerid][pZbran2naboje] = 0;
}
new rand = random(sizeof(RandomSpawn));
SetPlayerPos(playerid, RandomSpawn[rand][0], RandomSpawn[rand][1], RandomSpawn[rand][2]);
SetPlayerFacingAngle(playerid, RandomSpawn[rand][3]);
SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
GivePlayerWeapon(playerid, PlayerInfo[playerid][pZbran0],PlayerInfo[playerid][pZbran0]);
GivePlayerWeapon(playerid, PlayerInfo[playerid][pZbran1],PlayerInfo[playerid][pZbran1]);
GivePlayerWeapon(playerid, PlayerInfo[playerid][pZbran2],PlayerInfo[playerid][pZbran2]);
PlayerTextDrawShow(playerid, PlayerTS[playerid][0]);
PlayerTextDrawShow(playerid, PlayerTS[playerid][1]);
PlayerTextDrawDestroy(playerid, PlayerTD[playerid][0]);
PlayerTextDrawDestroy(playerid, PlayerTD[playerid][1]);
return 1;
}
OnPlayerDisconnect
public OnPlayerDisconnect(playerid, reason)
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_WriteInt(File,"Wanted",PlayerInfo[playerid][pWanted]);
INI_WriteInt(File,"Skin",PlayerInfo[playerid][pSkin]);
INI_WriteInt(File,"VodickyB",PlayerInfo[playerid][pVodickyB]);
INI_WriteInt(File,"VodickyC",PlayerInfo[playerid][pVodickyC]);
GetPlayerWeaponData(playerid, 0, PlayerInfo[playerid][pZbran0], PlayerInfo[playerid][pZbran0naboje]);
INI_WriteInt(File,"Zbran0",PlayerInfo[playerid][pZbran0]);
INI_WriteInt(File,"Zbran0naboje",PlayerInfo[playerid][pZbran0naboje]);
GetPlayerWeaponData(playerid, 1, PlayerInfo[playerid][pZbran1], PlayerInfo[playerid][pZbran1naboje]);
INI_WriteInt(File,"Zbran1",PlayerInfo[playerid][pZbran1]);
INI_WriteInt(File,"Zbran1naboje",PlayerInfo[playerid][pZbran1naboje]);
GetPlayerWeaponData(playerid, 2, PlayerInfo[playerid][pZbran2], PlayerInfo[playerid][pZbran2naboje]);
INI_WriteInt(File,"Zbran2",PlayerInfo[playerid][pZbran2]);
INI_WriteInt(File,"Zbran2naboje",PlayerInfo[playerid][pZbran2naboje]);
INI_WriteInt(File,"Sekundy",pSekundy[playerid]);
INI_WriteInt(File,"Minuty",pMinuty[playerid]);
INI_WriteInt(File,"Hodiny",pHodiny[playerid]);
INI_Close(File);
KillTimer(NahranyCas[playerid]);
PlayerTextDrawDestroy(playerid, PlayerTS[playerid][0]);
PlayerTextDrawDestroy(playerid, PlayerTS[playerid][1]);
return 1;
}
Potom ešte v registracii mam aby sa vytvorilo v zlozle "Zbran1 - (hodnota) , zbran1naboje - (hodnota)
Ale ukladanie do súboru mi funguje lebo ked pridem na server a cez prikaz si vlozim .. - Boxer,basbalku a desert eagle.. a odhlasim sa ukazuje mi to takto
Zbran2naboje = 100
Zbran2 = 24
Zbran1naboje = 1
Zbran1 = 5
Zbran0naboje = 1
Zbran0 = 1
Ale ked sa prihlasim už mi ich nenačíta samozrejme potom sa odstrania pri dalsom disconnecte kedze už nemam žiadne zbrane..
Edited by MrShoTys74Link to comment
Share on other sites
4 odpovědí na tuto otázku
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now