Register bug
#1

This is code from register/login system

Код:
public OnPlayerRequestClass(playerid, classid)
{
	PlayerPlaySound(playerid, 1068, 0.0, 0.0, 0.0);
	PlayerInfo[playerid][pModel] = Peds[classid][0];

	if (RegistrationStep[playerid] == 0 && gPlayerLogged[playerid] != 1)
	{
		ClearChatbox(playerid, 10);
		SendClientMessage(playerid, COLOR_GREEN, " ~ Dobrodosli na Zagreb City Roleplay~");
		SendClientMessage(playerid, COLOR_RED, " Koristi 12 znakova u svojoj sifri! ");
		SendClientMessage(playerid, COLOR_YELLOW2, " ");
		SendClientMessage(playerid, COLOR_YELLOW2, " ");
		SendClientMessage(playerid, COLOR_YELLOW2, " ");
		SendClientMessage(playerid, COLOR_YELLOW2, " ");
		SendClientMessage(playerid, COLOR_YELLOW2, " ");
		SendClientMessage(playerid, COLOR_YELLOW2, " ");
		if (gPlayerAccount[playerid] != 0)
		{
			new loginstring[128];
			new loginname[64];
			GetPlayerName(playerid,loginname,sizeof(loginname));
			format(loginstring,sizeof(loginstring),"Dobrodosli, %s\nTo ime je registrirano.\nSada se mozes ulogirati:",loginname);
			ShowPlayerDialog(playerid,12346,DIALOG_STYLE_INPUT,"Ulogiranje",loginstring,"Login","Izlaz");
		}
		else
		{
			gPlayerAccount[playerid] = 1;
 			new regstring[128];
			new regname[64];
			GetPlayerName(playerid,regname,sizeof(regname));
			format(regstring,sizeof(regstring),"Dobrodosli, %s\nTo ime nije registrirano.\nMolimo da se registrirate:",regname);
			ShowPlayerDialog(playerid,12345,DIALOG_STYLE_INPUT,"Registracija",regstring,"Registriraj","Odustani");
		}
		//PlayerPlaySound(playerid, 1187, 0.0, 0.0, 0.0);
		PlayerInfo[playerid][pModel] = Peds[classid][0];
		SetPlayerTeamFromClass(playerid,classid);
	}
	else SpawnPlayer(playerid);
	return false;
and when i register my nick, and left server and again join i need to register again and always same but my accout is saved in scriptfiles can someone help me
-tnx alot

if need i will put "OnPlayerDialogRespone"
Reply
#2

By the looks of your code you dont permantley save it
Reply
#3

can you edit code please
Reply
#4

you need to have a function on OnPlayerDisconnect to save the players stats when he disconnects. but you need to make a function because you have only a few sec. to save the information
Reply
#5

This is code from Dissconect

Код:
public OnPlayerDisconnect(playerid, reason)
{
	gActivePlayers[playerid]--;
	numplayers--;
	if(reason == 0)
	{
	  PlayerInfo[playerid][pCrashed] = 1;
	  for(new slot = 0; slot != 12; slot++)
	  {
	    new wep, ammo;
	    GetPlayerWeaponData(playerid, slot, wep, ammo);

	    if(wep != 0 && ammo != 0)
	    {
	      if(PlayerInfo[playerid][pGun1] == 0) { PlayerInfo[playerid][pGun1] = wep; PlayerInfo[playerid][pAmmo1] = ammo; }
	      else if(PlayerInfo[playerid][pGun2] == 0) { PlayerInfo[playerid][pGun2] = wep; PlayerInfo[playerid][pAmmo2] = ammo; }
	      else if(PlayerInfo[playerid][pGun3] == 0) { PlayerInfo[playerid][pGun3] = wep; PlayerInfo[playerid][pAmmo3] = ammo; }
	      else if(PlayerInfo[playerid][pGun4] == 0) { PlayerInfo[playerid][pGun4] = wep; PlayerInfo[playerid][pAmmo4] = ammo; }
	    }
	  }
	}
	OnPlayerUpdate(playerid);
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
	  if(IsPlayerConnected(i))
	  {
	    if(TaxiAccepted[i] < 999)
	    {
		    if(TaxiAccepted[i] == playerid)
		    {
		      TaxiAccepted[i] = 999;
		      GameTextForPlayer(i, "~w~Taxi pozivatelj~n~~r~Napustio igru", 5000, 1);
		      TaxiCallTime[i] = 0;
		      DisablePlayerCheckpoint(i);
		    }
	    }
	    else if(BusAccepted[i] < 999)
	    {
		    if(BusAccepted[i] == playerid)
		    {
		      BusAccepted[i] = 999;
		      GameTextForPlayer(i, "~w~Bus pozivatelj~n~~r~Napustio igru", 5000, 1);
		      BusCallTime[i] = 0;
		      DisablePlayerCheckpoint(i);
		    }
	    }
	  }
	}
	/*if(GettingCK[playerid] < 999)
	{
	  if(IsPlayerConnected(GettingCK[playerid]))
	  {
	    SendClientMessage(GettingCK[playerid], COLOR_YELLOW, "Your Character Kill has left the server, try again later.");
	    OnCK[GettingCK[playerid]] = 999;
	  }
	}*/
	if (GetPlayerVehicleID(playerid) == 131) SetVehicleToRespawn(131);
	OnPlayerUpdate(playerid);
	//----------------------------------------------------------
	if(TransportCost[playerid] > 0 && TransportDriver[playerid] < 999)
	{
	  if(IsPlayerConnected(TransportDriver[playerid]))
		{
		  new string[64];
		  TransportMoney[TransportDriver[playerid]] += TransportCost[playerid];
		  TransportTime[TransportDriver[playerid]] = 0;
		  TransportCost[TransportDriver[playerid]] = 0;
		  format(string, sizeof(string), "~w~Putnik napusta~n~~g~zarada $%d",TransportCost[playerid]);
		  GameTextForPlayer(TransportDriver[playerid], string, 5000, 1);
		}
	}
	if(GotHit[playerid] > 0)
	{
	  if(GetChased[playerid] < 999)
	  {
	    if(IsPlayerConnected(GetChased[playerid]))
	    {
	    	SendClientMessage(GetChased[playerid], COLOR_YELLOW, "Tvoja meta je napustila server.");
	      GoChase[GetChased[playerid]] = 999;
			}
	  }
	}
	if(PlayerPaintballing[playerid] != 0)
	{
	  PaintballPlayers --;
	}
	if(PlayerKarting[playerid] > 0 && PlayerInKart[playerid] > 0)
	{
	  KartingPlayers --;
	}
	if(PlayersChannel[playerid] < 999)
	{
		IRCInfo[PlayersChannel[playerid]][iPlayers] -= 1;
	}
	if(HireCar[playerid] != 299)
	{
		gLastDriver[HireCar[playerid]] = 300;
		gCarLock[HireCar[playerid]] = 0;
		UnLockCar(HireCar[playerid]);
		if(reason != 0)
		{
			SetVehicleToRespawn(HireCar[playerid]);
		}
	}
	if(GangCar[playerid] != 512)
	{
		gLastDriver[GangCar[playerid]] = 520;
		gCarLock[GangCar[playerid]] = 0;
		UnLockCar(GangCar[playerid]);
	}
	if (gLastCar[playerid] > 0)
	{
		gLastDriver[gLastCar[playerid]] = 300;
		if(PlayerInfo[playerid][pPhousekey] != gLastCar[playerid]-1)
		{
			gCarLock[gLastCar[playerid]] = 0;
			UnLockCar(gLastCar[playerid]);
		}
	}
	if(PlayerBoxing[playerid] > 0)
	{
	  if(Boxer1 == playerid)
	  {
	    if(IsPlayerConnected(Boxer2))
	    {
	    	PlayerBoxing[Boxer2] = 0;
	    	SetPlayerPos(Boxer2, 765.8433,3.2924,1000.7186);
	    	SetPlayerInterior(Boxer2, 5);
	    	PlayerInfo[Boxer2][pInt] = 5;
	    	GameTextForPlayer(Boxer2, "~r~Borba", 5000, 1);
			}
	  }
	  else if(Boxer2 == playerid)
	  {
	    if(IsPlayerConnected(Boxer1))
	    {
	    	PlayerBoxing[Boxer1] = 0;
	    	SetPlayerPos(Boxer1, 765.8433,3.2924,1000.7186);
	    	SetPlayerInterior(Boxer1, 5);
	    	PlayerInfo[Boxer2][pInt] = 5;
	    	GameTextForPlayer(Boxer1, "~r~Borba", 5000, 1);
			}
	  }
	  InRing = 0;
   	RoundStarted = 0;
		Boxer1 = 255;
		Boxer2 = 255;
		TBoxer = 255;
	}
  if(TransportDuty[playerid] == 1)
	{
		TaxiDrivers -= 1;
	}
  else if(TransportDuty[playerid] == 2)
	{
		BusDrivers -= 1;
	}
	if(PlayerInfo[playerid][pJob] == 11)
	{
	  if(JobDuty[playerid] == 1) { Medics -= 1; }
	}
	else if(PlayerInfo[playerid][pJob] == 7)
	{
	  if(JobDuty[playerid] == 1) { Mechanics -= 1; }
	}
	else if(PlayerInfo[playerid][pJob] == 17)
	{
		if(JobDuty[playerid] == 1) { PizzaBoys -= 1; }
	}
	if (PlayerInfo[playerid][pRoadblock] != 0)
	{
		RemoveRoadblock(playerid);
	}
	BusrouteEast[playerid][0] = 0;
	BusrouteWest[playerid][0] = 0;
	TextDrawHideForPlayer(playerid,lbt);
	TextDrawHideForPlayer(playerid,lbb);
}
Reply
#6

bump
Reply
#7

bump
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)