ae na brzaka ko zna

Započeo Salke, Jul 11, 2021, 11:30:27 PRE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Problem(error/warning): Kad se neko logira i pogresi lozinku ono njega stavlja na poziciju spawna a ja ne zelim tu nego da ostane u zraku gde je bio dok ne upise tacnu lozinku
Pawno Code:  https://www.youtube.com/watch?v=1xTQj3MZshs
Dio skripte: [ pawn ]//[/pawn]
Debug iz server_log(ukoliko je u pitanju crashanje servera - crashdetect log): [ code ]nepotrbeno[ /code ]
Slika/video ingame problema(obavezno ako je ingame problem): //
Poslednja Izmena: Jul 11, 2021, 20:54:34 POSLE PODNE od M Ө M Σ N Z I

Bon voyage idi ljubavi mojaa sve sam dala da bih bila tvojaa

Daj code od connecta do dialoga do spawna

#include <a_samp>

#include <YSI\y_ini>

#define DIALOG_REGISTER 	1
#define DIALOG_LOGIN 		2

#define PATH "/Korisnici/%s.ini"

enum pInfo
{
	pLozinka,
	pNovac,
	pLevel,
	pAdmin
};
new PlayerInfo[MAX_PLAYERS][pInfo];

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;
}

main ( ) { }
public OnGameModeInit()
{
	SetGameModeText("B:DM v1.0");
	return 1;
}

public OnGameModeExit()
{
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
	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)
{
	SendClientMessage(playerid, -1, "Dobrodosli na server!");
	if(fexist(UserPath(playerid)))
	{
	    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra=true, .extra=playerid);
	    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Unesite vasu lozinku:", "Prijavi se", "Odustani");
	}
	else
 	{
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Register", "Unesite vasu lozinku:", "Registruj se", "Odustani");
 	}
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
	new INI:File = INI_Open(UserPath(playerid));
	INI_SetTag(File, "data");
 	INI_WriteInt(File, "Novac", GetPlayerMoney(playerid));
 	INI_WriteInt(File, "Level", PlayerInfo[playerid][pLevel]);
 	INI_WriteInt(File, "Admin", PlayerInfo[playerid][pAdmin]);
 	INI_Close(File);
	return 1;
}

public OnPlayerSpawn(playerid)
{
	SetPlayerPos(playerid, 1126.4000,-2036.9590,69.8837);
	return 1;
}

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

public OnVehicleSpawn(vehicleid)
{
	return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
	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)
{
	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_PASSWORD, "Register", "Unesite vasu lozinku:", "Registruj se", "Odustani");
		        new INI:File = INI_Open(UserPath(playerid));
		        INI_SetTag(File, "data");
		        INI_WriteInt(File, "Lozinka", udb_hash(inputtext));
		        INI_WriteInt(File, "Novac", 25000);
		        INI_WriteInt(File, "Level", 2);
		        INI_WriteInt(File, "Admin", 0);
		        INI_Close(File);
		        SpawnPlayer(playerid);
		        GivePlayerMoney(playerid, 25000);
		        SetCameraBehindPlayer(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_PASSWORD, "Login", "Unesite vasu lozinku:", "Prijavi se", "Odustani");
		        }
		        return 1;
		    }
	    }
	}
	return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
	return 1;
}
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("Level",PlayerInfo[playerid][pLevel]);
	INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
	return 1;
}



pozdrav za JABUCICU XD

Mislim da ti OnPlayerRequestClass postavi poziciju i kameru

#include <a_samp>

#include <YSI\y_ini>

#define DIALOG_REGISTER 	1
#define DIALOG_LOGIN 		2

#define PATH "/Korisnici/%s.ini"

enum pInfo
{
	pLozinka,
	pNovac,
	pLevel,
	pAdmin
};
new PlayerInfo[MAX_PLAYERS][pInfo];

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;
}

main ( ) { }
public OnGameModeInit()
{
	SetGameModeText("B:DM v1.0");
	return 1;
}

public OnGameModeExit()
{
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
	return 1;
}

public OnPlayerConnect(playerid)
{
	SendClientMessage(playerid, -1, "Dobrodosli na server!");
	if(fexist(UserPath(playerid)))
	{
	    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra=true, .extra=playerid);
	    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Unesite vasu lozinku:", "Prijavi se", "Odustani");
	}
	else
 	{
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Register", "Unesite vasu lozinku:", "Registruj se", "Odustani");
 	}
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
	new INI:File = INI_Open(UserPath(playerid));
	INI_SetTag(File, "data");
 	INI_WriteInt(File, "Novac", GetPlayerMoney(playerid));
 	INI_WriteInt(File, "Level", PlayerInfo[playerid][pLevel]);
 	INI_WriteInt(File, "Admin", PlayerInfo[playerid][pAdmin]);
 	INI_Close(File);
	return 1;
}

public OnPlayerSpawn(playerid)
{
	SetPlayerPos(playerid, 1126.4000,-2036.9590,69.8837);
	return 1;
}

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

public OnVehicleSpawn(vehicleid)
{
	return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
	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)
{
	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_PASSWORD, "Register", "Unesite vasu lozinku:", "Registruj se", "Odustani");
		        new INI:File = INI_Open(UserPath(playerid));
		        INI_SetTag(File, "data");
		        INI_WriteInt(File, "Lozinka", udb_hash(inputtext));
		        INI_WriteInt(File, "Novac", 25000);
		        INI_WriteInt(File, "Level", 2);
		        INI_WriteInt(File, "Admin", 0);
		        INI_Close(File);
		        SpawnPlayer(playerid);
		        GivePlayerMoney(playerid, 25000);
		        SetCameraBehindPlayer(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]);
		            SpawnPlayer(playerid);
		            return 1;
		        }
		        else
		        {
		            ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Unesite vasu lozinku:", "Prijavi se", "Odustani");
		            return 1;
		        }
		    }
	    }
	}
	return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
	return 1;
}
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("Level",PlayerInfo[playerid][pLevel]);
	INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
	return 1;
}


Odradi samo copy paste, mrzi me da objasnjavam...

Ukratko pogledaj OnPlayerRequestClass i OnPlayerRequestSpawn, takodje response za DIALOG_LOGIN i shvatices

Ako ces bas da postavis neki drugi spawn, koristi SetSpawnInfo
Poslednja Izmena: Jul 11, 2021, 12:03:22 POSLE PODNE od V01D

HVALA CARE JA SE MUCIO 2 DANA DA OVO FIXAM
<3333