[Pomoc]Error u register/login sistemu!

Započeo Tommaso Moreti, Februar 01, 2013, 20:43:47 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 2 gostiju pregledaju ovu temu.



stavi ovo na kraj skripte stock UserPath(playerid)
{
new string[128],playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
format(string,sizeof(string),PATH,playername);
return string;
}
i ovo na vrh #define PATH "/Korisnici/%s.ini" ove umesto Korisnici upises ime tvog .ini fajla gde spremas dadoteke accova



Evo ti cijela moja skripta... ako ti se da pronaÄ'i :D !
// Western Balkan DM
// Vlasnik:Tommaso
#include <a_samp>
#if defined FILTERSCRIPT
#define SERVER_USER_FILE "igraci/%s.ini"
#include <YSI\y_ini>
#define DIALOG_REGISTER 1
#define DIALOG_LOGIN 2
#define PATH "/Korisnici/%s.ini"

public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");
return 1;
}

public OnFilterScriptExit()
{
return 1;
}

#else

main()
{
print("\n----------------------------------");
print(" Blank Gamemode by your name here");
print("----------------------------------\n");
}

#endif

enum pInfo
{
    pAdminLevel,
    pCash,
    pScore,
}

public OnGameModeInit()
{
CreateObject(10378, 754.55, -1359.51, 12.19,   0.00, 0.00, 359.37);
CreateObject(5004, 733.21, -1355.07, 11.90,   0.00, 0.00, 356.93);
CreateObject(3436, 692.18, -1347.24, 18.33,   0.00, 0.00, 2.20);
CreateObject(1571, 775.97, -1346.41, 13.22,   0.00, 0.00, 359.60);
CreateObject(1500, 777.96, -1345.38, 11.94,   0.00, 0.00, 271.64);
CreateObject(2942, 779.68, -1345.18, 12.77,   0.00, 0.00, 359.60);
CreateObject(970, 825.42, -1337.36, 13.04,   0.00, 0.00, 0.87);
CreateObject(970, 825.42, -1337.36, 13.04,   0.00, 0.00, 0.87);
CreateObject(970, 825.40, -1337.40, 13.04,   0.00, 0.00, 0.87);
CreateObject(970, 821.41, -1337.47, 12.98,   0.00, 0.00, 0.00);
CreateObject(970, 817.28, -1337.46, 12.99,   0.00, 0.00, 359.86);
CreateObject(970, 815.87, -1349.79, 13.03,   0.00, 0.00, 0.39);
CreateObject(3437, 807.32, -1358.18, 15.70,   0.00, 0.00, 78.33);
CreateObject(970, 807.58, -1354.85, 13.09,   0.00, 0.00, 90.89);
CreateObject(970, 807.52, -1350.77, 13.09,   0.00, 0.00, 90.89);
CreateObject(970, 817.89, -1347.69, 12.99,   0.00, 0.00, 90.79);
CreateObject(970, 807.45, -1346.68, 13.09,   0.00, 0.00, 90.89);
CreateObject(3437, 828.47, -1336.85, 15.70,   0.00, 0.00, 0.00);
CreateObject(19121, 810.69, -1337.54, 13.13,   0.00, 0.00, 0.20);
CreateObject(19121, 807.17, -1340.57, 13.13,   0.00, 0.00, 0.20);
CreateObject(14467, 815.76, -1347.04, 15.18,   0.00, 0.00, 181.00);
CreateObject(970, 813.10, -1337.44, 13.03,   0.00, 0.00, 0.00);
CreateObject(970, 807.39, -1342.52, 13.09,   0.00, 0.00, 90.79);
CreateObject(970, 813.79, -1347.70, 12.99,   0.00, 0.00, 90.79);
CreateObject(970, 815.77, -1345.62, 13.03,   0.00, 0.00, 0.39);
}


public OnGameModeExit()
{
return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);// Ovde stavite koordinate svog spawna
SpawnPlayer(playerid);
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
return 1;
}

public OnPlayerConnect(playerid)
{
(code)if(fexist(UserPath(playerid)))
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Prijavljivanje","Ukucajte lozinku da bi se ulogovali","Prijavi se","Izadji");
}
else
{
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"Registracija","Ukucajte lozinku da bi se registrovali.","Registruj se","Izadji");
}

//=====================================Ukalnjanje objekata na spawnu====================

public OnPlayerDisconnect(playerid, reason)
{
    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][pUbistva]);
INI_WriteInt(File,"Smrti",PlayerInfo[playerid][pSmrti]);
INI_Close(File);
return 1;
}

public OnPlayerSpawn(playerid)
{
SetPlayerPos(playerid,823.5189,-1341.0173,13.5165);
return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}

public OnVehicleSpawn(vehicleid)
{
return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
PlayerInfo[killerid][pUbistva]++;
PlayerInfo[playerid][pSmrti]++;
return 1;
}

public OnPlayerText(playerid, text[])
{
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/mycommand", cmdtext, true, 10) == 0)
{
// Do something here
return 1;
}
return 0;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{



return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
return 1;
}

public OnRconCommand(cmd[])
{
return 1;
}

public OnPlayerRequestSpawn(playerid)
{
SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);// Ovde stavite koordinate svog spawna
SpawnPlayer(playerid);
return 1;
}

public OnObjectMoved(objectid)
{
return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
return 1;
}

public OnPlayerExitedMenu(playerid)
{
return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
return 1;
}

public OnPlayerUpdate(playerid)
{
return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
{
case DIALOG_REGISTER:
{
if(!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Registracija","Ukucali ste pogresnu lozinku.\nUkucajte ispravnu lozinku da bi se registrovali.","Registruj se","Izadji");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Lozinka",udb_hash(inputtext));
INI_WriteInt(File,"Novac",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Ubistva",0);
INI_WriteInt(File,"Smrti",0);
INI_Close(File);
SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);// Ovde stavite koordinate svog spawna
SpawnPlayer(playerid);
}
}
case DIALOG_LOGIN:
{
if(!response) return Kick(playerid);
if(response)
{
if(udb_hash(inputtext) == PlayerInfo[playerid][pLozinka])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pNovac]);
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Prijavljivanje","Ukucali ste pogresnu lozinku.\nUkucajte ispravnu lozinku da bi se ulogovali.","Prijavi se","Izadji");
}
return 1;
}
}
}

return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}
//========================================Tutorial========
enum pInfo
{
pLozinka,
pNovac,
pAdmin,
pUbistva,
pSmrti
};
new PlayerInfo[MAX_PLAYERS][pInfo];
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
INI_Int("Lozinka",PlayerInfo[playerid][pLozinka]);
INI_Int("Novac",PlayerInfo[playerid][pNovac]);
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
INI_Int("Ubistva",PlayerInfo[playerid][pUbistva]);
INI_Int("Smrti",PlayerInfo[playerid][pSmrti]);
return 1;
}
stock UserPath(playerid)
{
new string[128],playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
format(string,sizeof(string),PATH,playername);
return string;
}
stock udb_hash(buf[])
{
new length=strlen(buf);
new s1 = 1;
new s2 = 0;
new n;
for (n=0; n<length; n++)
{
s1 = (s1 + buf[n]) % 65521;
s2 = (s2 + s1)     % 65521;
}
return (s2 << 16) + s1;
}
Poslednja Izmena: Februar 03, 2013, 12:54:21 POSLE PODNE od Tommaso Moreti