skripta: moja od 0
opis problema:
imam ovo
public OnPlayerDisconnect(playerid, reason)
{
new Float:x, Float:y, Float:z;
//==========================
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Novac",GetPlayerMoney(playerid));
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Ubistva",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Smrti",PlayerInfo[playerid][pDeaths]);
INI_WriteInt(File,"Lider",PlayerInfo[playerid][pLeader]);
INI_WriteInt(File,"Clan",PlayerInfo[playerid][pMember]);
INI_WriteInt(File,"Rank",PlayerInfo[playerid][pRank]);
INI_WriteInt(File,"Skin",PlayerInfo[playerid][pSkin]);
INI_WriteInt(File,"Org_Skin",PlayerInfo[playerid][pOrg_Skin]);
INI_Close(File);
//============================
return 1;
}
e sad mi treba da sacuvam pozicije ali ne znam kako... da li da dodam GetPlayerPos(playerid, x, y, z) pa onda dalje nesto ili kako
napisi gde treba sta da stavim...
evo stavio sam ovako
enum pInfo
{
pPass,
pCash,
pAdmin,
pKills,
pDeaths,
pLeader,
pMember,
pRank,
pSkin,
pOrg_Skin,
FirmaID,
Float:pPozicijaX,
Float:pPozicijaY,
Float:pPozicijaZ;
public OnPlayerDisconnect(playerid, reason)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
//==========================
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Novac",GetPlayerMoney(playerid));
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Ubistva",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Smrti",PlayerInfo[playerid][pDeaths]);
INI_WriteInt(File,"Lider",PlayerInfo[playerid][pLeader]);
INI_WriteInt(File,"Clan",PlayerInfo[playerid][pMember]);
INI_WriteInt(File,"Rank",PlayerInfo[playerid][pRank]);
INI_WriteInt(File,"Skin",PlayerInfo[playerid][pSkin]);
INI_WriteInt(File,"Org_Skin",PlayerInfo[playerid][pOrg_Skin]);
INI_WriteFloat(File, "X", PlayerInfo[playerid][pPozicijaX]);
INI_WriteFloat(File, "Y", PlayerInfo[playerid][pPozicijaY]);
INI_WriteFloat(File, "Z", PlayerInfo[playerid][pPozicijaZ]);
INI_Close(File);
//============================
return 1;
}
ali on mi sacuva ali pozicije su 0.000 sve.....
Tvoj onplayeridisconnect zameni sa ovim:
public OnPlayerDisconnect(playerid, reason)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
//==========================
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Novac",GetPlayerMoney(playerid));
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Ubistva",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Smrti",PlayerInfo[playerid][pDeaths]);
INI_WriteInt(File,"Lider",PlayerInfo[playerid][pLeader]);
INI_WriteInt(File,"Clan",PlayerInfo[playerid][pMember]);
INI_WriteInt(File,"Rank",PlayerInfo[playerid][pRank]);
INI_WriteInt(File,"Skin",PlayerInfo[playerid][pSkin]);
INI_WriteInt(File,"Org_Skin",PlayerInfo[playerid][pOrg_Skin]);
INI_WriteFloat(File, "X", x);
INI_WriteFloat(File, "Y", y);
INI_WriteFloat(File, "Z", z);
INI_Close(File);
//============================
return 1;
}
sad je super cuva mi poziciju ali na spawnu me ne spawna tamo..
case DIALOG_LOGIN:
{
if ( !response ) return Kick ( playerid );
if( response )
{
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""C_WHITE"Success!",""C_WHITE"You have successfully logged in!","Ok","");
SetPlayerPos(playerid, PlayerInfo[playerid][pPozicijaX], PlayerInfo[playerid][pPozicijaY], PlayerInfo[playerid][pPozicijaZ]);
SpawnPlayer(playerid);
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""C_WHITE"Login",""C_RED"You have entered an incorrect password.\n"C_WHITE"Type your password below to login.","Login","Quit");
}
return 1;
}
}
Citat: ladolez poslato Maj 09, 2013, 09:14:23 PRE PODNE
sad je super cuva mi poziciju ali na spawnu me ne spawna tamo..
case DIALOG_LOGIN:
{
if ( !response ) return Kick ( playerid );
if( response )
{
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""C_WHITE"Success!",""C_WHITE"You have successfully logged in!","Ok","");
SetPlayerPos(playerid, PlayerInfo[playerid][pPozicijaX], PlayerInfo[playerid][pPozicijaY], PlayerInfo[playerid][pPozicijaZ]);
SpawnPlayer(playerid);
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""C_WHITE"Login",""C_RED"You have entered an incorrect password.\n"C_WHITE"Type your password below to login.","Login","Quit");
}
return 1;
}
}
pa kad radis i provjeru spawna???
moras izbrisat ovo
SpawnPlayer(playerid);
u sk Sam sad pa kad stignem kuci proba cu ali ako stavim pod spawn svaki put na spawnu ce da me spawna na posledju pos
neradi nista od toga -.-
BUMP
pa nadi taj dio kad te spawna sad bez tih pozicija i samo zamjeni, nema tu neke logike
evo sad cu na pm da ti posaljem mod.. mali je
Ako još nisi riješio problem, onda unutar OnDialogReponse callbacka onaj dio za DIALOG_LOGIN zamijeni ovime:
case DIALOG_LOGIN:
{
if ( !response ) return Kick ( playerid );
if( response )
{
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""C_WHITE"Success!",""C_WHITE"You have successfully logged in!","Ok","");
SpawnPlayer(playerid);
SetPlayerPos(playerid, PlayerInfo[playerid][pPozicijaX], PlayerInfo[playerid][pPozicijaY], PlayerInfo[playerid][pPozicijaZ]);
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""C_WHITE"Login",""C_RED"You have entered an incorrect password.\n"C_WHITE"Type your password below to login.","Login","Quit");
}
return 1;
}
}