SA-MP Forums Archive
Can't spawn in my own server - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Can't spawn in my own server (/showthread.php?tid=612339)



Can't spawn in my own server - Shayels - 16.07.2016

Hello, I found some gamemode which I wanted to try, when I logged in I couldn't spawn, it should give me a dialog of register and login, it just doesn't show it.. anyone can help me with that?


Re: Can't spawn in my own server - Shayels - 16.07.2016

please help me with that, I can include photos and that just I need it fast.


Re: Can't spawn in my own server - Tass007 - 16.07.2016

Post your callback of public OnPlayerConnect and then your public OnDialogResponse


Re: Can't spawn in my own server - Shayels - 17.07.2016

Quote:
Originally Posted by Tass007
Посмотреть сообщение
Post your callback of public OnPlayerConnect and then your public OnDialogResponse
I hope I give correct information..

Код:
public OnPlayerConnect(playerid)
{
	new IP[16];
	GetPlayerIp(playerid, IP, sizeof(IP));

	if(IsPlayerNPC(playerid))
	{
		//if(strcmp(IP, "127.0.0.1") != 0)
		if(strcmp(IP, "162.220.33.252") != 0 && strcmp(IP, "127.0.0.1") != 0)
		{
			SendClientMessage(playerid, COLOR_RED, "Sorry, we don't allow NPC connections from external IP addresses.");
			printf("[Security]: NPC connection from %s rejected.", IP);
			Kick(playerid);
			return 1;
		}
	}

	if(!BobTheBuilder[playerid])
	{
		RemoveServerBuildings(playerid); //faction/server maps maps ect
		//DestroyAllBuildings(playerid);
		//removeMineObjects(playerid);  //mine objects (can be added to server buildings later)

		//check if player is banned
		new query[200];
		mysql_format(sqlGameConnection, query, sizeof(query), "SELECT * FROM `banlist` INNER JOIN `players` ON `players`.`ID` = `banlist`.`userID` WHERE `players`.`Name` = '%e' OR `banlist`.`IP` = '%e'", PlayerName(playerid), IP);
		//QueryLog(playerid, query);
		mysql_pquery(sqlGameConnection, query, "OnBanListCheck", "d", playerid);
	}

	BobTheBuilder[playerid] = 0;
    //PlayerOnFire[playerid] = 0;
	resetPlayerVars(playerid);
	DisablePlayerCheckpoint(playerid);
	DisablePlayerCheckpointEx(playerid);
	TogglePlayerAllDynamicCPs(playerid, false);
	dOnPlayerConnect(playerid); //donorScripts.inc
	return 1;
}

stock BanAccount(giveplayerid, playerid, reason[], expires[] = "2030-01-01")
{
	new IP[16];
	GetPlayerIp(giveplayerid, IP, sizeof(IP));

	new name[MAX_PLAYER_NAME];

	if(playerid == INVALID_PLAYER_ID) {
		format(name, sizeof(name), "Autoban");
	} else {
		GetPlayerName(playerid, name, sizeof(name));
	}
	new query[256];
	mysql_format(sqlGameConnection, query, sizeof(query), "INSERT INTO `banlist` (`ID`, `userID`, `IP`, `Reason`, `BannedBy`, `Date`, `Expires`, `Banned`) VALUES(NULL, %d, '%e', '%e', '%e', NOW(), '%e', 1)", PlayerInfo[giveplayerid][pID], IP, reason, name, expires);
	//QueryLog(playerid, query);
	mysql_pquery(sqlGameConnection, query);

	PlayerInfo[giveplayerid][pBand] = 3;
	BanEx(giveplayerid, reason); //change this back to kick in future
	//Kick(giveplayerid);
	return 1;
}

CMD:bans(playerid, params[]){
	if(PlayerInfo[playerid][pAdmin] >= 2){
	    new name[24], query[128];
	    if(sscanf(params, "s[24]", name))return SendClientMessage(playerid, COLOR_GREY, "USAGE: /bans [player_name]");
	    {
	        mysql_format(sqlGameConnection, query, sizeof(query), "SELECT `ID` FROM `players` WHERE `Name`='%e' LIMIT 1", name);
			mysql_pquery(sqlGameConnection, query, "onBansChecked", "is", playerid, name);
	    }
	}
	else return AdmErrorMsg;
	return 1;
}
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	//printf("OnDialogResponse(playerid: %d, dialogid: %d)", playerid, dialogid);
	if( ammo_OnDialogResponse( playerid, dialogid, response, listitem, inputtext ) == 1 ) return 1;
	if( dialogid == DIALOG_TUTORIAL_AGE ) {
		if( !response )
			return ShowPlayerDialog( playerid, DIALOG_TUTORIAL_AGE, DIALOG_STYLE_INPUT, "Enter an age for your character", "The age must be between 18 and 80.", "Okay", "" );
		new age = strval( inputtext );
		if( age < 18 || age > 80 ) {
			return ShowPlayerDialog( playerid, DIALOG_TUTORIAL_AGE, DIALOG_STYLE_INPUT, "Enter an age for your character", "The age must be between 18 and 80.", "Okay", "" );
		}
		PlayerInfo[playerid][pAge] = age;
		PlayerTutStage[playerid]++;
		Tutorial( playerid, PlayerTutStage[playerid] );
		return 1;
	}



Re: Can't spawn in my own server - Tass007 - 17.07.2016

There is nothing there stating a login / registration system. Therefore that is why you aren't spawning.


Re: Can't spawn in my own server - Shayels - 17.07.2016

Quote:
Originally Posted by Tass007
Посмотреть сообщение
There is nothing there stating a login / registration system. Therefore that is why you aren't spawning.
What can I do about it? any way I could remove the login/registration or add it somehow?

BTW I think I do have a registration/login system
Код:
enum {
	OnPlayerConnect
	DIALOG_LOGIN,
	DIALOG_REGISTER,



Re: Can't spawn in my own server - Tass007 - 17.07.2016

Display where your DIALOG_LOGIN and, DIALOG_REGISTER is.


Re: Can't spawn in my own server - Sew_Sumi - 17.07.2016

This is what release threads are for... Finding others who have used the mode, and so that others can also go and get that mode to test it for you to see if they can help.


Link to the thread, and next time post in the release thread.


Re: Can't spawn in my own server - Shayels - 17.07.2016

Quote:
Originally Posted by Tass007
Посмотреть сообщение
Display where your DIALOG_LOGIN and, DIALOG_REGISTER is.
I'd rather removing the registration and login system than fixing it, but if it's easier fixing it then...
And it's displaying over the definitions where u do like #define [whatever]




Re: Can't spawn in my own server - Sew_Sumi - 17.07.2016

Where did you get the script from.