/login bag
#1

If i do the command /login when i didnt register
its crash my samp server

Here is my /login and /register system:


Код:
//-------------------------------[Login]--------------------------------------------------------------------------
	if (strcmp(cmd, "/login", true) ==0 || strcmp(cmd, "/l", true) == 0 )
	{
	  if(IsPlayerConnected(playerid))
	  {
	    new tmppass[64];
			if(gPlayerLogged[playerid] == 1)
			{
				SendClientMessage(playerid, TEAM_AZTECAS_COLOR, "SERVER: You are already logged in.");
				return 1;
			}
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, TEAM_AZTECAS_COLOR, "USAGE: /login [password]");
				return 1;
			}
			strmid(tmppass, tmp, 0, strlen(cmdtext), 255);
			//Encrypt(tmppass);
			OnPlayerLogin(playerid,tmppass);
		}
		return 1;
	}
	//-----------Register---------------
	if (strcmp(cmd, "/register", true) ==0 )
	{
	  if(IsPlayerConnected(playerid))
	  {
	    if(gPlayerLogged[playerid] == 1)
			{
				SendClientMessage(playerid, TEAM_AZTECAS_COLOR, "SERVER: You are already logged in.");
				return 1;
			}
			GetPlayerName(playerid, sendername, sizeof(sendername));
			new namestring = strfind(sendername, "_", true);
			if(namestring == -1)
			{
				SendClientMessage(playerid, TEAM_AZTECAS_COLOR, "Immigration: Your name is not acceptable.");
				SendClientMessage(playerid, TEAM_AZTECAS_COLOR, "Hint: Your name must be in the format Firstname_Lastname.");
				Kick(playerid);
				return 1;
			}
			else
			{
				GetPlayerName(playerid, sendername, sizeof(sendername));
				//format(string, sizeof(string), "%s.ini", sendername);
				new sqlaccountexists = MySQLCheckAccount(sendername);
				//new File: hFile = fopen(string, io_read);
				if (sqlaccountexists != 0)
				{
					SendClientMessage(playerid, TEAM_AZTECAS_COLOR, "Immigration: There is already a citizen with that name.");
					//fclose(hFile);
					return 1;
				}
	    	new tmppass[64];
				tmp = strtok(cmdtext, idx);
				if(!strlen(tmp))
				{
					SendClientMessage(playerid, TEAM_AZTECAS_COLOR, "USAGE: /register [password]");
					return 1;
				}
				strmid(tmppass, tmp, 0, strlen(cmdtext), 255);
				//Encrypt(tmppass);
				OnPlayerRegister(playerid,tmppass);
			}
		}
		return 1;
	}
Reply
#2

You're not checking if the player is registered, find the code for the system you're using & check if they're if they're just send them a message telling the person to type "/register <password>".
Reply
#3

Im still dont got you.
Reply
#4

Show OnPlayerLogin, plz.
Reply
#5

Код:
public OnPlayerLogin(playerid,password[]) // by Luk0r v1.0
{
	MySQLCheckConnection();
	new tmp2[256];
  new string2[64];
	new playername2[MAX_PLAYER_NAME];
	new playernamesplit[3][MAX_PLAYER_NAME];
  GetPlayerName(playerid, playername2, sizeof(playername2));
	split(playername2, playernamesplit, '_');
	MySQLFetchAcctSingle(PlayerInfo[playerid][pSQLID], "Password", PlayerInfo[playerid][pKey]);
	if(strcmp(PlayerInfo[playerid][pKey],password, true ) == 0 )
	{
		new Data[1024];
		new Field[64];
		new rcnt = 1; 
		MySQLFetchAcctRecord(PlayerInfo[playerid][pSQLID], Data);
		samp_mysql_strtok(Field, "|", Data);
		while (samp_mysql_strtok(Field, "|", "")==1)
		{
			// The rcnt values here represent the order of the columns in the characters table, so don't mess with them
			// If you add a column to the table, just add a new line with a +1 rcnt to the block below
			// Start it at 3 to skip the first few records we don't need (id, player name, password)
			if (rcnt == 3) PlayerInfo[playerid][pLevel] = strval(Field);
			if (rcnt == 4) PlayerInfo[playerid][pAdmin] = strval(Field);
			if (rcnt == 5) PlayerInfo[playerid][pDonateRank] = strval(Field);
			if (rcnt == 6) PlayerInfo[playerid][gPupgrade] = strval(Field);
			if (rcnt == 7) PlayerInfo[playerid][pConnectTime] = strval(Field);
			if (rcnt == 8) PlayerInfo[playerid][pReg] = strval(Field);
			if (rcnt == 9) PlayerInfo[playerid][pSex] = strval(Field);
			if (rcnt == 10) PlayerInfo[playerid][pAge] = strval(Field);
			if (rcnt == 11) PlayerInfo[playerid][pOrigin] = strval(Field);
			if (rcnt == 12) PlayerInfo[playerid][pCK] = strval(Field);
			if (rcnt == 13) PlayerInfo[playerid][pMuted] = strval(Field);
			if (rcnt == 14) PlayerInfo[playerid][pExp] = strval(Field);
			if (rcnt == 15) PlayerInfo[playerid][pCash] = strval(Field);
			if (rcnt == 16) PlayerInfo[playerid][pAccount] = strval(Field);
			if (rcnt == 17) PlayerInfo[playerid][pCrimes] = strval(Field);
			if (rcnt == 18) PlayerInfo[playerid][pKills] = strval(Field);
			if (rcnt == 19) PlayerInfo[playerid][pDeaths] = strval(Field);
			if (rcnt == 20) PlayerInfo[playerid][pArrested] = strval(Field);
			if (rcnt == 21) PlayerInfo[playerid][pWantedDeaths] = strval(Field);
			if (rcnt == 22) PlayerInfo[playerid][pPhoneBook] = strval(Field);
			if (rcnt == 23) PlayerInfo[playerid][pLottoNr] = strval(Field);
			if (rcnt == 24) PlayerInfo[playerid][pFishes] = strval(Field);
			if (rcnt == 25) PlayerInfo[playerid][pBiggestFish] = strval(Field);
			if (rcnt == 26) PlayerInfo[playerid][pJob] = strval(Field);
			if (rcnt == 27) PlayerInfo[playerid][pPayCheck] = strval(Field);
			if (rcnt == 28) PlayerInfo[playerid][pHeadValue] = strval(Field);
			if (rcnt == 29) PlayerInfo[playerid][pJailed] = strval(Field);
			if (rcnt == 30) PlayerInfo[playerid][pJailTime] = strval(Field);
			if (rcnt == 31) PlayerInfo[playerid][pMats] = strval(Field);
			if (rcnt == 32) PlayerInfo[playerid][pDrugs] = strval(Field);
			if (rcnt == 33) PlayerInfo[playerid][pLeader] = strval(Field);
			if (rcnt == 34) PlayerInfo[playerid][pMember] = strval(Field);
			if (rcnt == 35) PlayerInfo[playerid][pFMember] = strval(Field);
			if (rcnt == 36) PlayerInfo[playerid][pRank] = strval(Field);
			if (rcnt == 37) PlayerInfo[playerid][pChar] = strval(Field);
			if (rcnt == 38) PlayerInfo[playerid][pContractTime] = strval(Field);
			if (rcnt == 39) PlayerInfo[playerid][pDetSkill] = strval(Field);
			if (rcnt == 40) PlayerInfo[playerid][pSexSkill] = strval(Field);
			if (rcnt == 41) PlayerInfo[playerid][pBoxSkill] = strval(Field);
			if (rcnt == 42) PlayerInfo[playerid][pLawSkill] = strval(Field);
			if (rcnt == 43) PlayerInfo[playerid][pMechSkill] = strval(Field);
			if (rcnt == 44) PlayerInfo[playerid][pJackSkill] = strval(Field);
			if (rcnt == 45) PlayerInfo[playerid][pCarSkill] = strval(Field);
			if (rcnt == 46) PlayerInfo[playerid][pNewsSkill] = strval(Field);
			if (rcnt == 47) PlayerInfo[playerid][pDrugsSkill] = strval(Field);
			if (rcnt == 48) PlayerInfo[playerid][pCookSkill] = strval(Field);
			if (rcnt == 49) PlayerInfo[playerid][pFishSkill] = strval(Field);
			if (rcnt == 50) PlayerInfo[playerid][pSHealth] = floatstr(Field);
			if (rcnt == 51) PlayerInfo[playerid][pHealth] = floatstr(Field);
			if (rcnt == 52) PlayerInfo[playerid][pInt] = strval(Field);
			if (rcnt == 53) PlayerInfo[playerid][pLocal] = strval(Field);
			if (rcnt == 54) PlayerInfo[playerid][pTeam] = strval(Field);
			if (rcnt == 55) PlayerInfo[playerid][pModel] = strval(Field);
			if (rcnt == 56) PlayerInfo[playerid][pPnumber] = strval(Field);
			if (rcnt == 57) PlayerInfo[playerid][pPhousekey] = strval(Field);
			if (rcnt == 58) PlayerInfo[playerid][pPcarkey] = strval(Field);
			if (rcnt == 59) PlayerInfo[playerid][pPapptkey] = strval(Field);
			if (rcnt == 60) PlayerInfo[playerid][pPbiskey] = strval(Field);
			if (rcnt == 61) PlayerInfo[playerid][pPos_x] = floatstr(Field);
			if (rcnt == 62) PlayerInfo[playerid][pPos_y] = floatstr(Field);
			if (rcnt == 63) PlayerInfo[playerid][pPos_z] = floatstr(Field);
			if (rcnt == 64) PlayerInfo[playerid][pCarLic] = strval(Field);
			if (rcnt == 65) PlayerInfo[playerid][pFlyLic] = strval(Field);
			if (rcnt == 66) PlayerInfo[playerid][pBoatLic] = strval(Field);
			if (rcnt == 67) PlayerInfo[playerid][pFishLic] = strval(Field);
			if (rcnt == 68) PlayerInfo[playerid][pGunLic] = strval(Field);
			if (rcnt == 69) PlayerInfo[playerid][pGun1] = strval(Field);
			if (rcnt == 70) PlayerInfo[playerid][pGun2] = strval(Field);
			if (rcnt == 71) PlayerInfo[playerid][pGun3] = strval(Field);
			if (rcnt == 72) PlayerInfo[playerid][pGun4] = strval(Field);
			if (rcnt == 73) PlayerInfo[playerid][pAmmo1] = strval(Field);
			if (rcnt == 74) PlayerInfo[playerid][pAmmo2] = strval(Field);
			if (rcnt == 75) PlayerInfo[playerid][pAmmo3] = strval(Field);
			if (rcnt == 76) PlayerInfo[playerid][pAmmo4] = strval(Field);
			if (rcnt == 77) PlayerInfo[playerid][pCarTime] = strval(Field);
			if (rcnt == 78) PlayerInfo[playerid][pPayDay] = strval(Field);
			if (rcnt == 79) PlayerInfo[playerid][pPayDayHad] = strval(Field);
			if (rcnt == 80) PlayerInfo[playerid][pCDPlayer] = strval(Field);
			if (rcnt == 81) PlayerInfo[playerid][pWins] = strval(Field);
			if (rcnt == 82) PlayerInfo[playerid][pLoses] = strval(Field);
			if (rcnt == 83) PlayerInfo[playerid][pAlcoholPerk] = strval(Field);
			if (rcnt == 84) PlayerInfo[playerid][pDrugPerk] = strval(Field);
			if (rcnt == 85) PlayerInfo[playerid][pMiserPerk] = strval(Field);
			if (rcnt == 86) PlayerInfo[playerid][pPainPerk] = strval(Field);
			if (rcnt == 87) PlayerInfo[playerid][pTraderPerk] = strval(Field);
			if (rcnt == 88) PlayerInfo[playerid][pTut] = strval(Field);
			if (rcnt == 89) PlayerInfo[playerid][pMissionNr] = strval(Field);
			if (rcnt == 90) PlayerInfo[playerid][pWarns] = strval(Field);
			if (rcnt == 91) PlayerInfo[playerid][pAdjustable] = strval(Field);
			if (rcnt == 92) PlayerInfo[playerid][pFuel] = strval(Field);
			if (rcnt == 93) PlayerInfo[playerid][pMarried] = strval(Field);
			if (rcnt == 94) PlayerInfo[playerid][pMarriedTo] = strmid(PlayerInfo[playerid][pMarriedTo], Field, 0, strlen(Field)-1, 255);
			if (rcnt == 96) PlayerInfo[playerid][pLinked] = strval(Field);
			if (rcnt == 97) PlayerInfo[playerid][pDeagle] = strval(Field);
			if (rcnt == 98) PlayerInfo[playerid][pShotgun] = strval(Field);
			if (rcnt == 99) PlayerInfo[playerid][pRifle] = strval(Field);
			if (rcnt == 100) PlayerInfo[playerid][pSDPistol] = strval(Field);
			if (rcnt == 101) PlayerInfo[playerid][pMP5] = strval(Field);
			if (rcnt == 102) PlayerInfo[playerid][pM4] = strval(Field);
			if (rcnt == 103) PlayerInfo[playerid][pAK47] = strval(Field);
			rcnt++;
		}
		samp_mysql_free_result();
	}
	else
	{
		SendClientMessage(playerid, COLOR_WHITE, "SERVER: Password does not match your name.");
		//fclose(UserFile);
		gPlayerLogTries[playerid] += 1;
		if(gPlayerLogTries[playerid] == 4) { Ban(playerid); }
		return 1;
	}
	PlayerInfo[playerid][pAdjustable] = 0;
	SafeResetPlayerMoney(playerid);
	//ConsumingMoney[playerid] = 1;
	CurrentMoney[playerid] = PlayerInfo[playerid][pCash];
	SafeGivePlayerMoney(playerid,PlayerInfo[playerid][pCash]);

	SafeGivePlayerWeapon(playerid,24,PlayerInfo[playerid][pDeagle]);
	SafeGivePlayerWeapon(playerid,25,PlayerInfo[playerid][pShotgun]);
	SafeGivePlayerWeapon(playerid,33,PlayerInfo[playerid][pRifle]);
	SafeGivePlayerWeapon(playerid,23,PlayerInfo[playerid][pSDPistol]);
	SafeGivePlayerWeapon(playerid,29,PlayerInfo[playerid][pMP5]);
	SafeGivePlayerWeapon(playerid,31,PlayerInfo[playerid][pM4]);
	SafeGivePlayerWeapon(playerid,30,PlayerInfo[playerid][pAK47]);

	if(PlayerInfo[playerid][pReg] == 0)
	{
		PlayerInfo[playerid][pLevel] = 1;
		PlayerInfo[playerid][pSHealth] = 0.0;
		PlayerInfo[playerid][pHealth] = 50.0;
		PlayerInfo[playerid][pPos_x] = 2246.6;
		PlayerInfo[playerid][pPos_y] = -1161.9;
		PlayerInfo[playerid][pPos_z] = 1029.7;
		PlayerInfo[playerid][pInt] = 15;
		PlayerInfo[playerid][pLocal] = 255;
		PlayerInfo[playerid][pTeam] = 3;
		PlayerInfo[playerid][pModel] = 264;
		new randphone = 100000 + random(899999);//minimum 1000 max 9999 //giving one at the start
		PlayerInfo[playerid][pPnumber] = randphone;
		PlayerInfo[playerid][pPhousekey] = 255;
		PlayerInfo[playerid][pPcarkey] = 999;
		PlayerInfo[playerid][pPapptkey] = 255;
		PlayerInfo[playerid][pPbiskey] = 255;
		PlayerInfo[playerid][pAccount] = 0;
		PlayerInfo[playerid][pReg] = 1;
		SafeGivePlayerMoney(playerid, 500);
	}
	if(PlayerInfo[playerid][pLevel] == -999) //autoban
	{
		Ban(playerid);
	}
	else if(PlayerInfo[playerid][pCK] > 0)
	{
		Kick(playerid);
	}
	
	// Add an entry to the login log
	new ipaddress[16];
	GetPlayerIp(playerid,ipaddress,sizeof(ipaddress));
	MySQLAddLoginRecord(PlayerInfo[playerid][pSQLID], ipaddress);
	
	ClearChatbox(playerid, 8);
	format(string2, sizeof(string2), "Server: Welcome to the State of San Andreas, %s.",playernamesplit[0]);
	SendClientMessage(playerid, COLOR_WHITE, string2);
	SendClientMessage(playerid, COLOR_WHITE, " ");
	printf("%s has logged in.",playername2);
	if (PlayerInfo[playerid][pDonateRank] > 0)
	{
		SendClientMessage(playerid, COLOR_WHITE,"People of LS: Thank you for donating so we can live!");
	}
	if (PlayerInfo[playerid][pAdmin] > 0)
	{
		format(string2, sizeof(string2), "SERVER: You are logged in as a Level %d Admin.",PlayerInfo[playerid][pAdmin]);
		SendClientMessage(playerid, COLOR_WHITE,string2);
	}
	if (PlayerInfo[playerid][pLinked] == 0)
	{
		SendClientMessage(playerid, COLOR_LIGHTRED, "WARNING: Your character is not linked to a website account! Register on Forums or some features will be restricted!");
	}
	
	// Reset the FirstSpawn variable
	SetTimerEx("UnsetFirstSpawn", 5000, false, "i", playerid);
	
	SetSpawnInfo(playerid, PlayerInfo[playerid][pTeam], PlayerInfo[playerid][pModel], PlayerInfo[playerid][pPos_x], PlayerInfo[playerid][pPos_y], PlayerInfo[playerid][pPos_z], 1.0, -1, -1, -1, -1, -1, -1);
	if(gTeam[playerid] == 0)
	{
		gTeam[playerid] = 3;
	}
	else
	{
		gTeam[playerid] = PlayerInfo[playerid][pTeam];
	}
	gPlayerLogged[playerid] = 1;
	SpawnPlayer(playerid);
	format(tmp2, sizeof(tmp2), "~w~Welcome ~n~~y~  %s", playername2);
	DateProp(playerid);
	GameTextForPlayer(playerid, tmp2, 5000, 1);
	//SendClientMessage(playerid, COLOR_YELLOW, motd);
	if(PlayerInfo[playerid][pFMember] < 255)
	{
		format(tmp2, sizeof(tmp2), "Family MOTD: %s.", FamilyInfo[PlayerInfo[playerid][pFMember]][FamilyMOTD]);
		SendClientMessage(playerid, COLOR_YELLOW, tmp2);
	}
	//}
	return 1;
}
Reply
#6

Show OnPlayerConnect, thx.
Reply
#7

Код:
public OnPlayerConnect(playerid)
{
	new plname[MAX_PLAYER_NAME];
	GetPlayerName(playerid, plname, sizeof(plname));
	
	if(Security != 0) // what the hell is this?
	{
	  SendClientMessage(playerid, COLOR_YELLOW, "Host has broken one of the Agreement rules, action has been taken.");
	  Kick(playerid);
	  return 1;
 	}
	
/*	new string[256];
	// Check if the player is IP banned
	new playerip[16];
	GetPlayerIp(playerid, playerip, sizeof(playerip));
	new playeripbancheck = MySQLCheckIPBanned(playerip);
	if (playeripbancheck != 0)
	{
		new bannedreason[64];
		switch (playeripbancheck)
		{
			case 1:
				bannedreason = "manual ban by an admin";
				
			case 2:
				bannedreason = "manual control panel ban";
				
			case 3:
				bannedreason = "money cheat detected";
				
			case 4:
				bannedreason = "weapon cheat detected";
				
			default:
				bannedreason = "unknown";
		}
		format(string, sizeof(string), "You are banned from the server for the following reason: %s", bannedreason);
		SendClientMessage(playerid, COLOR_YELLOW, string);
		SendClientMessage(playerid, COLOR_YELLOW, "Please contact an admin if this message is in error.");
		Kick(playerid);
		return 1;
	}*/
	
	new namestring = strfind(plname, "_", true);
	if(namestring == -1)
	{
		SendClientMessage(playerid, TEAM_AZTECAS_COLOR, "Immigration: Your name is not acceptable.");
		SendClientMessage(playerid, TEAM_AZTECAS_COLOR, "Hint: Your name must be in the format Firstname_Lastname.");
		Kick(playerid);
		return 1;
	}
	
	for(new h = 158; h < sizeof(CarInfo); h++)
	{
		SetVehicleParamsForPlayer(h,playerid,0,CarInfo[h][cLock]);
	}
	gActivePlayers[playerid]++;
	numplayers++;
	//new string[MAX_PLAYER_NAME];
	SelectChar[playerid] = 0; HidePM[playerid] = 0; PhoneOnline[playerid] = 0; LearnTime[playerid] = 0;
	SelectCharID[playerid] = 0; SelectCharPlace[playerid] = 0; ChosenSkin[playerid] = 0;
	GettingJob[playerid] = 0; GuardOffer[playerid] = 999; GuardPrice[playerid] = 0;
  ApprovedLawyer[playerid] = 0; CallLawyer[playerid] = 0; WantLawyer[playerid] = 0;
	KickPlayer[playerid] = 0; /* //CurrentMoney[playerid] = 9999999999999999; */ UsedFind[playerid] = 0;
	CP[playerid] = 0; Robbed[playerid] = 0; SpawnChange[playerid] = 1;
	CarOffer[playerid] = 999; CarPrice[playerid] = 0; BegOffer[playerid] = 999; BegPrice[playerid] = 0; CarID[playerid] = 0; CarCalls[playerid] = 0; BrowsingCar[playerid] = 0;
	RobbedTime[playerid] = 0; MoneyMessage[playerid] = 0; Condom[playerid] = 0;
	STDPlayer[playerid] = 0; SexOffer[playerid] = 999; SexPrice[playerid] = 0;
	RepairOffer[playerid] = 999; RepairPrice[playerid] = 0; RepairCar[playerid] = 0;
	TalkingLive[playerid] = 255; LiveOffer[playerid] = 999; TakingLesson[playerid] = 0; LessonExitedVehicle[playerid] = 0; drivingtestexittmr[playerid] = 0;
	RefillOffer[playerid] = 999; RefillPrice[playerid] = 0; MapIconsShown[playerid] = 0;
	DrugOffer[playerid] = 999; PlayerCuffed[playerid] = 0; PlayerCuffedTime[playerid] = 0;
	DrugPrice[playerid] = 0; RegistrationStep[playerid] = 0; OnCK[playerid] = 999; GettingCK[playerid] = 999;
	DrugGram[playerid] = 0; ConnectedToPC[playerid] = 0; OrderReady[playerid] = 0;
	JailPrice[playerid] = 0; MedicTime[playerid] = 0; NeedMedicTime[playerid] = 0; MedicBill[playerid] = 0; GotHit[playerid] = 0;
	WantedPoints[playerid] = 0; GoChase[playerid] = 999; GetChased[playerid] = 999; PlacedNews[playerid] = 0;
	OnDuty[playerid] = 0; tactical[playerid] = 0; swat[playerid] = 0; copspawn[playerid] = 1; timesrobbed[playerid] = 0; WantedLevel[playerid] = 0; TestFishes[playerid] = 0;
	BoxWaitTime[playerid] = 0; SchoolSpawn[playerid] = 0; ChangePos2[playerid][1] = 0;
	SafeTime[playerid] = 60; TransportDuty[playerid] = 0; PlayerTied[playerid] = 0;
 	BusCallTime[playerid] = 0; TaxiCallTime[playerid] = 0; MedicCallTime[playerid] = 0; MechanicCallTime[playerid] = 0;
	BusrouteEast[playerid][0] = 0; BusrouteWest[playerid][0] = 0; BusShowLocation[playerid][0] = 0; BusShowLocationC[playerid] = 0;
	FindTimePoints[playerid] = 0; FindTime[playerid] = 0; JobDuty[playerid] = 0;
	Mobile[playerid] = 255; Music[playerid] = 0; BoxOffer[playerid] = 999; PlayerBoxing[playerid] = 0;
	Spectate[playerid] = 255; PlayerDrunk[playerid] = 0; PlayerDrunkTime[playerid] = 0; PlayerFull[playerid] = 0; PlayerFullTime[playerid] = 0;
	Unspec[playerid][sLocal] = 255; FishCount[playerid] = 0;
	WritingPaper[playerid] = 0; WritingPaperNumber[playerid] = 999; WritingLine[playerid] = 0; BringingPaper[playerid] = 0; GotPaper[playerid] = 0;
	PaperOffer[playerid] = 999;
	/* ConsumingMoney[playerid] = 0; BlockMoneyCheck[playerid] = 0; */
	ScriptMoney[playerid] = 0; ScriptMoneyUpdated[playerid] = 0;
	for (new c=0; c<13; c++) ScriptWeapons[playerid][c] = 0;
	ScriptWeaponsUpdated[playerid] = 0;
  gLastCar[playerid] = 0; FirstSpawn[playerid] = 1;
	gOoc[playerid] = 0; gNews[playerid] = 0; BigEar[playerid] = 0; gDice[playerid] = 0; gFam[playerid] = 0;
	gSpeedo[playerid] = 2; gGas[playerid] = 0;
	gPlayerLogged[playerid] = 0; gPlayerLogTries[playerid] = 0; gPlayerAccount[playerid] = 0;
	gPlayerSpawned[playerid] = 0; PlayerKarting[playerid] = 0; PlayerInKart[playerid] = 0;
	PlayerTazeTime[playerid] = 0; PlayerStoned[playerid] = 0;
	StartTime[playerid] = 0; TicketOffer[playerid] = 999; TicketMoney[playerid] = 0;
	MatsHolding[playerid] = 0; TutTime[playerid] = 0;
	gPlayerMission[playerid] = 0; TaxiAccepted[playerid] = 999; BusAccepted[playerid] = 999;
	PlayerInfo[playerid][pCash] = dollah; NoFuel[playerid] = 0;
	HireCar[playerid] = 299; HirePlane[playerid] = 299; PlayersChannel[playerid] = 999;
	TransportValue[playerid] = 0; TransportMoney[playerid] = 0; TransportTime[playerid] = 0; TransportCost[playerid] = 0; TransportDriver[playerid] = 999;
	Locator[playerid] = 0; PlayerOnMission[playerid] = 0; MissionCheckpoint[playerid] = 0;
	WatchingTV[playerid] = 0; PlayerPaintballing[playerid] = 0; PlayerPaintballKills[playerid] = 0;
	Fishes[playerid][pLastFish] = 0; Fishes[playerid][pFishID] = 0; DKT[playerid] = 0; pTest[playerid] = 0; pTestFly[playerid] = 0; pTestBoat[playerid] = 0;
	ProposeOffer[playerid] = 999; MarryWitness[playerid] = 999; MarryWitnessOffer[playerid] = 999; MarriageCeremoney[playerid] = 0; ProposedTo[playerid] = 999; GotProposedBy[playerid] = 999; DivorceOffer[playerid] = 999;
	SafeGivePlayerMoney(playerid,PlayerInfo[playerid][pCash]); tactical[playerid] = 0; swat[playerid] = 0; authorizeswat = 0; authorizetactical = 0; CostumeReady[playerid] = 0;
	PizzaCallTime[playerid] = 0; ScratchTimer[playerid] = 0; FishTimer[playerid] = 0;
	bPizza[playerid] = 0; sPizza[playerid] = 0;
	InAFoodPlace[playerid] = 0;
	PlayerInfo[playerid][pLevel] = 0;
	PlayerInfo[playerid][pAdmin] = 0;
	PlayerInfo[playerid][pDonateRank] = 0;
	PlayerInfo[playerid][gPupgrade] = 0;
	PlayerInfo[playerid][pConnectTime] = 0;
	PlayerInfo[playerid][pReg] = 0;
	PlayerInfo[playerid][pSex] = 0;
	PlayerInfo[playerid][pAge] = 0;
	PlayerInfo[playerid][pOrigin] = 0;
	PlayerInfo[playerid][pExp] = 0;
	PlayerInfo[playerid][pAccount] = 0;
	PlayerInfo[playerid][pCrimes] = 0;
	PlayerInfo[playerid][pDeaths] = 0;
	PlayerInfo[playerid][pArrested] = 0;
	PlayerInfo[playerid][pWantedDeaths] = 0;
	PlayerInfo[playerid][pPhoneBook] = 0;
	PlayerInfo[playerid][pLottoNr] = 0;
	PlayerInfo[playerid][pFishes] = 0;
	PlayerInfo[playerid][pBiggestFish] = 0;
	PlayerInfo[playerid][pJob] = 0;
	PlayerInfo[playerid][pJobLeader] = 0;
	PlayerInfo[playerid][pPayCheck] = 0;
	PlayerInfo[playerid][pHeadValue] = 0;
	PlayerInfo[playerid][pJailed] = 0;
	PlayerInfo[playerid][pJailTime] = 0;
	PlayerInfo[playerid][pMats] = 0;
	PlayerInfo[playerid][pDrugs] = 0;
	PlayerInfo[playerid][pLeader] = 0;
	PlayerInfo[playerid][pMember] = 0;
	PlayerInfo[playerid][pFMember] = 255;
	PlayerInfo[playerid][pRank] = 0;
	PlayerInfo[playerid][pChar] = 0;
	PlayerInfo[playerid][pContractTime] = 0;
	PlayerInfo[playerid][pDetSkill] = 0;
	PlayerInfo[playerid][pSexSkill] = 0;
	PlayerInfo[playerid][pBoxSkill] = 0;
	PlayerInfo[playerid][pLawSkill] = 0;
	PlayerInfo[playerid][pMechSkill] = 0;
	PlayerInfo[playerid][pJackSkill] = 0;
	PlayerInfo[playerid][pCarSkill] = 0;
	PlayerInfo[playerid][pNewsSkill] = 0;
	PlayerInfo[playerid][pDrugsSkill] = 0;
	PlayerInfo[playerid][pCookSkill] = 0;
	PlayerInfo[playerid][pFishSkill] = 0;
	PlayerInfo[playerid][pSHealth] = 0.0;
	PlayerInfo[playerid][pHealth] = 50.0;
	PlayerInfo[playerid][pPos_x] = 2246.6;
	PlayerInfo[playerid][pPos_y] = -1161.9;
	PlayerInfo[playerid][pPos_z] = 1029.7;
	PlayerInfo[playerid][pInt] = 15;
	PlayerInfo[playerid][pVirtualWorld] = 0;
	PlayerInfo[playerid][pLocal] = 255;
	PlayerInfo[playerid][pTeam] = 3;
	PlayerInfo[playerid][pModel] = 170;
	PlayerInfo[playerid][pModel] = NOOB_SKIN;
	new randphone = 100000 + random(899999);//minimum 100000 max 999999 //giving one at the start
	PlayerInfo[playerid][pPnumber] = randphone;
	PlayerInfo[playerid][pPcarkey] = 999;
	PlayerInfo[playerid][pPhousekey] = 255;
	PlayerInfo[playerid][pPapptkey] = 255;
	PlayerInfo[playerid][pPbiskey] = 255;
	PlayerInfo[playerid][pCarLic] = 0;
	PlayerInfo[playerid][pFlyLic] = 0;
	PlayerInfo[playerid][pBoatLic] = 0;
	PlayerInfo[playerid][pFishLic] = 0;
	PlayerInfo[playerid][pGunLic] = 0;
	PlayerInfo[playerid][pGun1] = 0;
	PlayerInfo[playerid][pGun2] = 0;
	PlayerInfo[playerid][pGun3] = 0;
	PlayerInfo[playerid][pGun4] = 0;
	PlayerInfo[playerid][pAmmo1] = 0;
	PlayerInfo[playerid][pAmmo2] = 0;
	PlayerInfo[playerid][pAmmo3] = 0;
	PlayerInfo[playerid][pAmmo4] = 0;
	PlayerInfo[playerid][pCarTime] = 0;
	PlayerInfo[playerid][pPayDay] = 0;
	PlayerInfo[playerid][pPayDayHad] = 0;
	PlayerInfo[playerid][pCDPlayer] = 0;
	PlayerInfo[playerid][pWins] = 0;
	PlayerInfo[playerid][pLoses] = 0;
	PlayerInfo[playerid][pAlcoholPerk] = 0;
	PlayerInfo[playerid][pDrugPerk] = 0;
	PlayerInfo[playerid][pMiserPerk] = 0;
	PlayerInfo[playerid][pPainPerk] = 0;
	PlayerInfo[playerid][pTraderPerk] = 0;
	PlayerInfo[playerid][pTut] = 0;
	PlayerInfo[playerid][pMissionNr] = 0;
	PlayerInfo[playerid][pWarns] = 0;
	PlayerInfo[playerid][pFuel] = 0;
	PlayerInfo[playerid][pAdjustable] = 0;
	PlayerInfo[playerid][pCallNumber] = 0;
	PlayerInfo[playerid][pRequestingBackup] = 0;
	PlayerInfo[playerid][pRoadblock] = 0;
	PlayerInfo[playerid][pSQLID] = 0;
	PlayerInfo[playerid][pLocked] = 0;
	PlayerInfo[playerid][pJustice] = 0;
	PlayerInfo[playerid][pLinked] = 0;
	PlayerInfo[playerid][pDeagle] = 0;
	PlayerInfo[playerid][pShotgun] = 0;
	PlayerInfo[playerid][pRifle] = 0;
	PlayerInfo[playerid][pSDPistol] = 0;
	PlayerInfo[playerid][pMP5] = 0;
	PlayerInfo[playerid][pM4] = 0;
	PlayerInfo[playerid][pAK47] = 0;
	ClearCrime(playerid);
	ClearFishes(playerid);
	ClearCooking(playerid);
	ClearGroceries(playerid);
	ClearMarriage(playerid);
	SetPlayerColor(playerid,COLOR_GRAD2);

	MySQLCheckConnection();
	
	// Check if the account exists
	new sqlaccountstatus = MySQLCheckAccount(plname);
	if(sqlaccountstatus != 0)
	{
		// Check if the account is locked
		if (MySQLCheckAccountLocked(sqlaccountstatus) != 0)
		{
			SendClientMessage(playerid, COLOR_LIGHTRED, "This account has been locked and cannot be accessed. Please contact an admin.");
			Kick(playerid);
			return 0;
		}
		gPlayerAccount[playerid] = 1;
		PlayerInfo[playerid][pSQLID] = sqlaccountstatus;
	}
	else
	{
		gPlayerAccount[playerid] = 0;
	}
	SendClientMessage(playerid, COLOR_YELLOW, "Please wait...");
	return 1;
}

Anyone know what should i do?
Reply
#8

You need check account if exist or not
Код:
if(!strcmp("login",cmdtext[1],5){
  //bla...
  if(!gPlayerAccount[playerid])
    return bla("You must register before loging in)"
  //bla...
}
Reply
#9

When i added this script

Код:
		if(!strcmp("login",cmdtext[1],5)
		{
    if(!gPlayerAccount[playerid])
    {
    return SendClientMessage(playerid, TEAM_AZTECAS_COLOR, "SERVER: You must register before loging in");
    }
		}
under if (strcmp(cmd, "/register", true) ==0 )

i get errors :/
Reply
#10

Quote:
Originally Posted by Ben147
When i added this script

Код:
		if(!strcmp("login",cmdtext[1],5)
		{
    if(!gPlayerAccount[playerid])
    {
    return SendClientMessage(playerid, TEAM_AZTECAS_COLOR, "SERVER: You must register before loging in");
    }
		}
under if (strcmp(cmd, "/register", true) ==0 )

i get errors :/
You need edit before adding...
Don't you know nothing about scripting?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)