Login System Help Please
#1

Hi all hope this is the correct place to place this as I am new to all this,
I have managed to get my server up and running no bother and got a few handy scripts and such in ,
but my problem is that because I have LuxAdmin script in when I go to /login it just says I am already logged in but when i click spawn it just says I need to login first.

now I sorta think it could be to do with because my gamemode has a login system of some sort and the luxadmin script has 1 they could be conflicting.
So I don't know how to disable the login script in the gamemode :

here is the part I think is the login system :
Код:
dcmd_register(playerid,params[])  {
	new index = 0;
    tmps1 = strtok(params, index);
	GetPlayerName(playerid, playername, sizeof(playername));
	if(!strlen(tmps1)) {
		SendClientMessage(playerid, COLOR_CMD, "* USAGE: /register [password]. This will register your nick. Don't forget your password.");
		return 1;
	}
    if(20 < strlen(tmps1) || strlen(tmps1) < 5) {
		SendClientMessage(playerid, COLOR_SYSTEM_PW, "* Password length must be 5-20 symbols.");
		return 1;
	} else {
		if (!dini_Exists(udb_encode(playername))) {
			dini_Create(udb_encode(playername));
			dini_IntSet(udb_encode(playername), "password", udb_hash(tmps1));
			dini_IntSet(udb_encode(playername), "newplayer", 1);
			dini_Set(udb_encode(playername), "ip", PlayerIp(playerid));
			format(strings, sizeof(strings), "%s --- %s (id: %d) created account. Passwordhash: %s. Ip: %s.", SystemTime,playername, playerid,udb_hash(tmps1), PlayerIp(playerid));
			printf(strings);
			format(strings, sizeof(strings), "* Account named %s created! You can login with /login %s.", playername, tmps1);
			SendClientMessage(playerid, COLOR_SYSTEM_PM, strings);
			if(spawned[playerid]){
				GameTextForPlayer(playerid, "~w~ You are not logged in! type /login", 120000, 3);
				LoginTimeout[playerid]=60;
			}
		} else {
			format(strings, sizeof(strings), "* %s is already registered.", playername,tmps1);
			SendClientMessage(playerid, COLOR_SYSTEM_PW, strings);
		}
	}
	return 1;
}

dcmd_login(playerid,params[])  {
    new index=0;
	tmps1=strtok(params,index);
    new balance, CurVal, temp;
    new m, giveback, propertyID;
	GetPlayerName(playerid, playername, sizeof(playername));
    if(!strlen(tmps1)) {
		SendClientMessage(playerid, COLOR_CMD, "* USAGE: /login [password]. This will log you into the server and restore your data.");
	} else {
		if (dini_Exists(udb_encode(playername))) {
	    	if (logged[playerid] == 1) {
	    	    format(strings, sizeof(strings), "--- %s is already logged in.", playername);
				printf(strings);
				SendClientMessage(playerid, COLOR_SYSTEM_PW, "* You are already logged in.");
			}
			else {
				tmps2 = dini_Get(udb_encode(playername), "password");
		  		if (udb_hash(tmps1) != strval(tmps2)) {
	  			    format(strings, sizeof(strings), "--- %s (id: %d) typed wrong password, Password with hash: %s.", playername, playerid, udb_hash(tmps1));
					printf(strings);
		    		SendClientMessage(playerid, COLOR_SYSTEM_PW, "* Wrong password.");
				}
				else {

					tmps3 = dini_Get(udb_encode(playername), "banned");
					if (strlen(tmps3)){
						if (strval(tmps3) == 1) {
						    SendClientMessage(playerid, COLOR_SYSTEM_GW, "* Your banned from this server.");
							format(strings, sizeof(strings),"User has been banned from the server.");
					        BanMsg(playerid, -1, strings);
							return 1;
						}
					}
					logged[playerid] = 1;
					SpawnTimeout[playerid] = 0;
					muted[playerid] = 0;
					SetTimerEx("LoginDelay", 5000, 0, "d", playerid);
					format(strings, sizeof(strings), "%s --- %s (id: %d) logged in. Passwordhash: %s.", SystemTime,playername, playerid, udb_hash(tmps1));
					printf(strings);
     				//TextDrawShowForPlayer(playerid, Welcome);
					//SetTimerEx("DestroyTextWelcome",4000,0,"d",playerid);
                    //	    GetPlayerName(playerid, nameP, MAX_PLAYER_NAME);
 					/*new newtext[41], nameP[MAX_PLAYER_NAME];
					GetPlayerName(playerid, nameP, MAX_PLAYER_NAME);
					format(newtext, sizeof(newtext), "~w~Welcome Back ~n~~h~~b~%s", nameP);
					TextDrawSetString(NamePlayer, newtext);
			  		TextDrawShowForPlayer(playerid, NamePlayer);
					SetTimerEx("DestroyTextName",4000,0,"d",playerid);*/

					//GetPlayerName(playerid, nameP, MAX_PLAYER_NAME);
					if(adminlevel[playerid] > 2)  {
					    SendClientMessage(playerid,COLOR_WHITE, "* Welcome back Admin");
					}
					if(spawned[playerid] == 1) {
						SetPlayerInterior(playerid,0);
						SetPlayerRandomSpawn(playerid);
					}

					tmps1 = dini_Get(udb_encode(playername), "money");
					balance = strval(tmps1);
					if(balance <= 0) balance = PocketMoney;
					tmps1 = dini_Get(FILE_SETTINGS, "maxmoney");
					if(balance > strval(tmps1)) balance = strval(tmps1);
					currentmoney[playerid] = balance;
					// TO-DO moneyscanner update
					format(moneyreason, sizeof(moneyreason), "* Money increased by $%d (old: $%d), because player-id %d connected and restored his money or got pocketmoney", balance, GetPlayerMoney(playerid), playerid);
					StatGivePlayerMoney(playerid, balance, moneyreason);
					tmps1 = dini_Get(udb_encode(playername), "bank");
					bank[playerid] = strval(tmps1);
					tmps1 = dini_Get(udb_encode(playername), "bounty");
					bounty[playerid] = strval(tmps1);

					tmps1 = dini_Get(udb_encode(playername), "jailed");
					if (strval(tmps1) == 1) jailed[playerid] = 1;
					tmps1 = dini_Get(udb_encode(playername), "jailtime");
					if (strval(tmps1) != 0) jailtime[playerid] = strval(tmps1);
					tmps1 = dini_Get(udb_encode(playername), "muted");
					if (strval(tmps1) == 1) muted[playerid] = 1;
					tmps1 = dini_Get(udb_encode(playername), "admin");
					if (strval(tmps1) > 0) adminlevel[playerid] = strval(tmps1);
					tmps1 = dini_Get(udb_encode(playername), "gamblelicence");
					if (strval(tmps1) == 1) gamblelicence[playerid] = 1;
					tmps1 = dini_Get(udb_encode(playername), "speedometer");
					if (strval(tmps1) == 1) speedometer[playerid] = 1;
					tmps1 = dini_Get(udb_encode(playername), "fuelmeteroff");
					if (strval(tmps1) == 1) FuelmeterOff[playerid] = 1;
					tmps1 = dini_Get(udb_encode(playername), "speedoon");
					if (strval(tmps1) == 1) speedometeron[playerid] = 1;
					tmps1 = dini_Get(udb_encode(playername), "autolock");
					if (strval(tmps1) == 1) autolock[playerid] = 1;
					tmps1 = dini_Get(udb_encode(playername), "protected");
					if (strval(tmps1) == 1) isprotected[playerid] = 1;
					tmps1 = dini_Get(udb_encode(playername), "fuelcan");
					if (strval(tmps1) == 1){
						Fuelcan[playerid] = 1;
						FuelcanContent[playerid] = 1;
					}
					tmps1 = dini_Get(udb_encode(playername), "payout");
					if (strval(tmps1) == 1) Payout[playerid] = 1;
					tmps1 = dini_Get(udb_encode(playername), "owncolorchosen");
					if (strval(tmps1) == 1){
					    OwnPlayerColorChosen[playerid] = 1;
						tmps1 = dini_Get(udb_encode(playername), "owncolor");
						if (strlen(tmps1)){
							if (strval(tmps1) < 999) OwnPlayerColor[playerid] = strval(tmps1);
						}
					}
					tmps1 = dini_Get(udb_encode(playername), "ownspawn");
					if (strval(tmps1) == 1) OwnSpawner[playerid] = 1;
					tmps1 = dini_Get(udb_encode(playername), "hudcolor");
					if (strval(tmps1) > 0) {
						HUDColor[playerid] = strval(tmps1);
					} else {
						HUDColor[playerid] = 0;
					}
					tmps1 = dini_Get(udb_encode(playername), "forbiddentuning");
					if(strval(tmps1) != 0 ) ForbiddenTuningTimes[playerid]=strval(tmps1);
					tmps1 = dini_Get(udb_encode(playername), "drivebywarning");
					if(strval(tmps1) != 0 ) DrivebyWarning[playerid]=strval(tmps1);
					tmps1 = dini_Get(udb_encode(playername), "weaponcheatwarning");
					if(strval(tmps1) != 0 ) WeaponCheatWarning[playerid]=strval(tmps1);
					tmps1 = dini_Get(udb_encode(playername), "regularplayer");
					if (strval(tmps1) == 1) RegularPlayer[playerid] = 1;
					tmps1 = dini_Get(udb_encode(playername), "helper");
					if (strval(tmps1) == 1){
						Helper[playerid] = 1;
						SendClientMessage(playerid, COLOR_BLUE , "* You are marked as helper. Type /helpermenu for available commands.");
						SendClientMessage(playerid, COLOR_BLUE , "* Note: you will NOT see this message again, it is only displayed upon loggin in.");
					}
					tmps1 = dini_Get(udb_encode(playername), "newplayer");
					if (strval(tmps1) == 1) NewPlayer[playerid] = 1;
					tmps1 = dini_Get(udb_encode(playername), "Total Warnings");
					TotalWarned[playerid] = strval( tmps1 );
					for(new i=0; i<5; i++){
					    m=i+1;
					    format(strings, sizeof(strings), "property%d", m);
					    tmps1 = dini_Get(udb_encode(playername), strings);
					    propertyID = strval(tmps1);
					    if(propertyID != 0) {
							if((propertyID == P_ANGELMED)  || (propertyID == P_ELQMED)){
								MedicalOfficer[playerid]=1;
							}
						    format(strings, sizeof(strings), "value%d", m);
						    tmps2 = dini_Get(udb_encode(playername), strings);
							if (strval(tmps2) != 0) {
       							CurVal = strval(tmps2);
								if(propertyOwner[propertyID] == 999){
									propertyArray[playerid][i] = propertyID;
									propertyOwner[propertyID] = playerid;
									ownedtime[propertyID] = 15;
									propertyCurrentValue[propertyID] = CurVal;
								} else {
									giveback=CurVal;
									format(strings, sizeof(strings),"* You are no longer the owner of %s, you have received $%d on your bank account.", propertyNames[propertyID], CurVal);
									SendClientMessage(playerid,COLOR_SYSTEM_PW,strings);
									bank[playerid]=bank[playerid]+giveback;
								}
							} else {
						        giveback = propertyOldValues[propertyID];
								SendClientMessage(playerid,COLOR_SYSTEM_PW,"* The property system on this server has changed. You reveice a full refund of the original propery values on your bank.");
								if(giveback < propertyOldValues[propertyID]){
									format(strings, sizeof(strings),"* You received for %s $%d on your bank account. This is not the full 100 percent, due to a full bank account.", propertyNames[propertyID], giveback);
								} else {
									format(strings, sizeof(strings),"* You received for %s $%d on your bank account.", propertyNames[propertyID], giveback);
								}
								SendClientMessage(playerid,COLOR_SYSTEM_PW,strings);
								bank[playerid]=bank[playerid]+giveback;
							}
						}
					}
					SaveProperties(playerid);
					for(new i=0; i<5; i++){
						m=i+1;
						format(strings, sizeof(strings), "property%d", m);
						dini_IntSet(udb_encode(playername), strings, propertyArray[playerid][i]);
						format(strings, sizeof(strings), "value%d", m);
						if(propertyArray[playerid][i] != 0){
							propertyID = propertyArray[playerid][i];
							dini_IntSet(udb_encode(playername), strings, propertyCurrentValue[propertyID]);
						} else {
							dini_IntSet(udb_encode(playername), strings, 0);
						}
					}
				    if(OwnPlayerColor[playerid] == 999){
					    SetPlayerColor(playerid, playerColors[playerid]);
					} else {
						temp=PlayerColorsChoice[OwnPlayerColor[playerid]];
					    SetPlayerColor(playerid, temp);
					}
				//	SendDeathMessage(INVALID_PLAYER_ID, playerid, 200);
					if(spawned[playerid] == 1 && jailed[playerid] == 1){
						SetPlayerInterior(playerid,10);
						SetPlayerPos(playerid,jailcelloc[jailcelcounter][0],jailcelloc[jailcelcounter][1],jailcelloc[jailcelcounter][2]);
						if(jailcelcounter < 3) {
						    jailcelcounter++;
						} else {
						    jailcelcounter=0;
						}
					}
					tmps1 = dini_Get(udb_encode(playername), "skincheck");
                    if (strval(tmps1) == 1){
                    	SpawnPlayer(playerid);
                    	SetPlayerSkin(playerid, dini_Int(udb_encode(playername),"skin"));
					}
				}
			}
		}
		else {
		    format(strings, sizeof(strings), "* %s no such account.", playername);
			SendClientMessage(playerid, COLOR_SYSTEM_PW, strings);
		}
	}
	return 1;
}
I would appreciate any help I am looking to have the luxadmin script intergrated or something .
just anything to make the luxadmin work.

Kind Regards
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)