SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 08/02/2018, 08:27 PM   #1
Akeem
Big Clucker
 
Join Date: Aug 2017
Location: Guyana
Posts: 96
Reputation: 0
Default how to force a command

so started my own server and when test it in lan mode the dialogue box pops up when i login to enter my password or register but when i upload it the dialogue box isn't popping up. so now players have to /login for that box to pop up and to load there stats. i want to force them to /login before or after class section or they will be kicked of refuse to /login.
Akeem is offline   Reply With Quote
Old 08/02/2018, 08:32 PM   #2
MarkNelson
Huge Clucker
 
MarkNelson's Avatar
 
Join Date: Feb 2016
Location: Tunisia
Posts: 434
Reputation: 46
Default Re: how to force a command

just try to use this function
Code:
//Example:
public OnPlayerRequestSpawn(playerid)
{
    if(!IsPlayerAdmin(playerid))
    {
        SendClientMessage(playerid, -1, "You may not spawn.");
        return 0;
    }
    return 1;
}
__________________
Code:
[Filterscript] Mechanic System V0.1 BETA
[Filterscript] Simple PM System
[Filterscript] Mechanic System V0.1 (Improved Version)
Please donate here:
paypal.me/Clark783
MarkNelson is offline   Reply With Quote
Old 08/02/2018, 09:57 PM   #3
solstice_
Gangsta
 
solstice_'s Avatar
 
Join Date: Feb 2016
Location: basement
Posts: 546
Reputation: 68
Default Re: how to force a command

Quote:
Originally Posted by MarkNelson View Post
just try to use this function
Code:
//Example:
public OnPlayerRequestSpawn(playerid)
{
    if(!IsPlayerAdmin(playerid))
    {
        SendClientMessage(playerid, -1, "You may not spawn.");
        return 0;
    }
    return 1;
}
What is that lol?
solstice_ is offline   Reply With Quote
Old 08/02/2018, 10:02 PM   #4
RogueDrifter
High-roller
 
RogueDrifter's Avatar
 
Join Date: Dec 2017
Location: SA-MP Drifting world.
Posts: 1,191
Reputation: 386
Default Re: how to force a command

Do what mark nelson said, if you return 0 at OnPlayerRequestSpawn the player will not spawn if they try to use the spawn button so do if(!IsPlayerLoggedIn) return 0;
BUT
There's a reason for that dialog not showing up you must've made a mistake, show where you're using the ShowPlayerDialog
__________________
Quote:
Originally Posted by Andy
I offer paid scripting services, I can do anything except mapping because fuck mapping.

[Github]:Link [Gists]:Link [Forum]:Link [Server]:Link [Discord]:Link


RogueDrifter is offline   Reply With Quote
Old 08/02/2018, 11:37 PM   #5
Akeem
Big Clucker
 
Join Date: Aug 2017
Location: Guyana
Posts: 96
Reputation: 0
Default Re: how to force a command

when i run it in lan mode its working fine but on ultra-h its not
Akeem is offline   Reply With Quote
Old 09/02/2018, 12:39 AM   #6
RogueDrifter
High-roller
 
RogueDrifter's Avatar
 
Join Date: Dec 2017
Location: SA-MP Drifting world.
Posts: 1,191
Reputation: 386
Default Re: how to force a command

Quote:
Originally Posted by Akeem View Post
when i run it in lan mode its working fine but on ultra-h its not
Show the code?
__________________
Quote:
Originally Posted by Andy
I offer paid scripting services, I can do anything except mapping because fuck mapping.

[Github]:Link [Gists]:Link [Forum]:Link [Server]:Link [Discord]:Link


RogueDrifter is offline   Reply With Quote
Old 09/02/2018, 01:10 AM   #7
Akeem
Big Clucker
 
Join Date: Aug 2017
Location: Guyana
Posts: 96
Reputation: 0
Default Re: how to force a command

Code:
/*------------------------------------------------------
-> Server login system
------------------------------------------------------*/
	new tmp;
	tmp = dini_Int("/eAdmin/Config/config.ini","MustLogin");

	if(tmp == 1)
	{
	  	if(dUserINT(GetName(playerid)).("Registered") == 1 && dUserINT(GetName(playerid)).("Loggedin") == 0)
	  	{
 			logged[playerid]=0;
			SelectTextDraw(playerid,COLOR_RED);

	  	    PlayerTextDrawHide(playerid,textdraw37);
			PlayerTextDrawHide(playerid,textdraw38);
			PlayerTextDrawHide(playerid,textdraw39);
			PlayerTextDrawHide(playerid,textdraw40);

			PlayerTextDrawHide(playerid,textdraw_10);

		    TextDrawShowForPlayer(playerid, Textdraw0);
			TextDrawShowForPlayer(playerid, Textdraw1);

			TextDrawHideForPlayer(playerid, Textdraw2);
			TextDrawHideForPlayer(playerid, Textdraw3);
			TextDrawHideForPlayer(playerid, Textdraw4);
			TextDrawHideForPlayer(playerid, Textdraw5);
			TextDrawHideForPlayer(playerid, Textdraw6);
			TextDrawHideForPlayer(playerid, Textdraw7);
			TextDrawHideForPlayer(playerid, Textdraw8);
			TextDrawHideForPlayer(playerid, Textdraw9);
			TextDrawHideForPlayer(playerid, Textdraw10);
			TextDrawHideForPlayer(playerid, Textdraw11);
			TextDrawHideForPlayer(playerid, Textdraw12);
			TextDrawHideForPlayer(playerid, Textdraw13);
			TextDrawHideForPlayer(playerid, Textdraw14);
			TextDrawHideForPlayer(playerid, Textdraw15);
			TextDrawHideForPlayer(playerid, Textdraw16);
			TextDrawHideForPlayer(playerid, Textdraw17);
			TextDrawHideForPlayer(playerid, Textdraw18);
			TextDrawHideForPlayer(playerid, Textdraw19);
			TextDrawHideForPlayer(playerid, Textdraw20);
			TextDrawHideForPlayer(playerid, Textdraw21);
			TextDrawHideForPlayer(playerid, Textdraw22);
			TextDrawHideForPlayer(playerid, Textdraw23);
			TextDrawHideForPlayer(playerid, Textdraw24);
			TextDrawHideForPlayer(playerid, Textdraw25);
			TextDrawHideForPlayer(playerid, Textdraw26);
			TextDrawHideForPlayer(playerid, Textdraw27);
			TextDrawHideForPlayer(playerid, Textdraw28);
			TextDrawHideForPlayer(playerid, Textdraw29);
			TextDrawHideForPlayer(playerid, Textdraw30);
			TextDrawHideForPlayer(playerid, Textdraw31);
			TextDrawHideForPlayer(playerid, Textdraw32);
			TextDrawHideForPlayer(playerid, Textdraw33);
			TextDrawHideForPlayer(playerid, Textdraw34);
			TextDrawHideForPlayer(playerid, Textdraw35);
			TextDrawHideForPlayer(playerid, Textdraw36);
			TextDrawHideForPlayer(playerid, Textdraw37);
			TextDrawHideForPlayer(playerid, Textdraw38);
			TextDrawHideForPlayer(playerid, Textdraw39);
			TextDrawHideForPlayer(playerid, Textdraw40);
			TextDrawHideForPlayer(playerid, Textdraw41);
			TextDrawHideForPlayer(playerid, Textdraw42);
			TextDrawHideForPlayer(playerid, Textdraw43);
			TextDrawHideForPlayer(playerid, Textdraw44);
			TextDrawHideForPlayer(playerid, Textdraw45);
			TextDrawHideForPlayer(playerid, Textdraw46);
			TextDrawHideForPlayer(playerid, Textdraw48);
			TextDrawHideForPlayer(playerid, Textdraw49);

			PlayerTextDrawHide(playerid, Textdraw50);


			for(new g; g<MAX_TEAMS; g++)
			{
		  		TextDrawHideForPlayer(playerid, textdraw2[g]);

				TextDrawHideForPlayer(playerid, textdraw4[g]);
				TextDrawHideForPlayer(playerid, textdraw5[g]);

				TextDrawHideForPlayer(playerid, textdraw7[g]);
				TextDrawHideForPlayer(playerid, textdraw8[g]);

				TextDrawHideForPlayer(playerid, textdraw10[g]);
				TextDrawHideForPlayer(playerid, textdraw11[g]);

				TextDrawHideForPlayer(playerid, textdraw13[g]);
				TextDrawHideForPlayer(playerid, textdraw14[g]);

				TextDrawHideForPlayer(playerid, textdraw16[g]);
				TextDrawHideForPlayer(playerid, textdraw17[g]);

				TextDrawHideForPlayer(playerid, textdraw19[g]);
				TextDrawHideForPlayer(playerid, textdraw20[g]);

				TextDrawHideForPlayer(playerid, textdraw22[g]);
				TextDrawHideForPlayer(playerid, textdraw23[g]);

				TextDrawHideForPlayer(playerid, textdraw25[g]);
				TextDrawHideForPlayer(playerid, textdraw26[g]);

				TextDrawHideForPlayer(playerid, textdraw28[g]);
				TextDrawHideForPlayer(playerid, textdraw29[g]);

				TextDrawHideForPlayer(playerid, textdraw31[g]);
			}
			TextDrawHideForPlayer(playerid, textdraw3);

			TextDrawHideForPlayer(playerid, textdraw6);

			TextDrawHideForPlayer(playerid, textdraw9);

			TextDrawHideForPlayer(playerid, textdraw12);

			TextDrawHideForPlayer(playerid, textdraw15);

			TextDrawHideForPlayer(playerid, textdraw18);

			TextDrawHideForPlayer(playerid, textdraw21);

			TextDrawHideForPlayer(playerid, textdraw24);

			TextDrawHideForPlayer(playerid, textdraw27);

			TextDrawHideForPlayer(playerid, textdraw30);

			TextDrawHideForPlayer(playerid, textdraw32);
			TextDrawHideForPlayer(playerid, textdraw33);
			TextDrawHideForPlayer(playerid, textdraw34);
			TextDrawHideForPlayer(playerid, textdraw35);

	  	    SetPlayerPos(playerid, 1380.6447,-1753.0427,13.5469);
			SetPlayerFacingAngle(playerid, 269.6420);
			SetPlayerCameraPos(playerid, 1387.2906,-1752.8887,13.3828);
			SetPlayerCameraLookAt(playerid, 1380.6447,-1753.0427,13.5469);
			SetPlayerSkin(playerid,TeamInfo[0][TeamSkin]);
			SetPlayerTeam(playerid,TEAM_0);
			return 1;
	  	}
	}
Akeem is offline   Reply With Quote
Old 09/02/2018, 01:12 AM   #8
RogueDrifter
High-roller
 
RogueDrifter's Avatar
 
Join Date: Dec 2017
Location: SA-MP Drifting world.
Posts: 1,191
Reputation: 386
Default Re: how to force a command

That's not the code i asked for, show where you used: ShowPlayerDialog the actual part where you show the player the dialog in order for him to login! might be at OnPlayerConnect or OnPlayerRequestClass
__________________
Quote:
Originally Posted by Andy
I offer paid scripting services, I can do anything except mapping because fuck mapping.

[Github]:Link [Gists]:Link [Forum]:Link [Server]:Link [Discord]:Link


RogueDrifter is offline   Reply With Quote
Old 09/02/2018, 01:21 AM   #9
Akeem
Big Clucker
 
Join Date: Aug 2017
Location: Guyana
Posts: 96
Reputation: 0
Default Re: how to force a command

hear whats up i was looking for the part that you wanted and i can't seem to fined it so here is the hold OnPlayerConnect

Code:
public OnPlayerConnect(playerid)
{
    #if EnableCamHack == true
    KeyState[playerid] = 0;
    FollowOn[playerid] = 0;
    AccInfo[playerid][InCamMod] 	= 0;
    AccInfo[playerid][LockedCam] 	= 0;
    #endif
	AccInfo[playerid][Deaths] 		= 0;
	AccInfo[playerid][Kills] 		= 0;
	AccInfo[playerid][Jailed]		= 0;
	AccInfo[playerid][Frozen]		= 0;
	AccInfo[playerid][Level] 		= 0;
	AccInfo[playerid][pVip]         = 0;
	AccInfo[playerid][LoggedIn] 	= 0;
	AccInfo[playerid][Registered] 	= 0;
	AccInfo[playerid][God] 			= 0;
	AccInfo[playerid][GodCar]		= 0;
	AccInfo[playerid][TimesSpawned]	= 0;
	AccInfo[playerid][Muted] 		= 0;
	AccInfo[playerid][MuteWarnings]	= 0;
	AccInfo[playerid][Warnings] 	= 0;
	AccInfo[playerid][Caps]			= 0;
	AccInfo[playerid][DoorsLocked] 	= 0;
	AccInfo[playerid][pCar]			= -1;
	AccInfo[playerid][SpamCount] 	= 0;
	AccInfo[playerid][MaxAdv] 		= 0;
	AccInfo[playerid][SpamTime] 	= 0;
	AccInfo[playerid][PingCount] 	= 0;
	AccInfo[playerid][PingTime]		= 0;
	AccInfo[playerid][FailLogin] 	= 0;
	AccInfo[playerid][Hide] 		= 0;
	AccInfo[playerid][pInvis]   	= 0;
	AccInfo[playerid][OnDuty]   	= 0;
	AccInfo[playerid][pGps] 		= -1;

	#if EnableTwoRcon == true
	AccInfo[playerid][MaxRcon] = 0;
	#endif

	AccInfo[playerid][ConnectTime] = gettime();
    for(new i; i<PING_MAX_EXCEEDS; i++)
	AccInfo[playerid][pPing][i] = 0;
	//------------------------------------------------------
	new string[128];
    new str[128];
	new file[256];
	new PlayerName[MAX_PLAYER_NAME];
	GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);
	new tmp3[50]; GetPlayerIp(playerid,tmp3,50);

	ResetForbiddenWeaponsForPlayer(playerid);
	TempBanCheck(playerid);
//==============================================================================
// Connect Messages
//==============================================================================
	if(ServerInfo[ConnectMessages] == 1)
	{
	    new pAKA[256];
		pAKA = dini_Get("/eAdmin/Config/aka.txt",tmp3);
		if (strlen(pAKA) < 3)
		format(str,sizeof(str),"[ User %s (Id: %d) has joined the server. ]", PlayerName,playerid);
		else if (!strcmp(pAKA,PlayerName,true))
		format(str,sizeof(str),"[ User %s (Id: %d) has joined the server. ]", PlayerName,playerid);
		else format(str,sizeof(str),"[ User %s (Id: %d) has joined the server (Aka: %s). ]",PlayerName,playerid,pAKA);

		for(new i = 0; i < MAX_PLAYERS; i++)
		if(IsPlayerConnected(i) && playerid != i)
		{
		if(AccInfo[i][Level] > 2)
		SendClientMessage(i,grey,str);
		else
		{
		format(string,sizeof(string),"[ User %s (Id: %d) has joined the server. ]", PlayerName, playerid);
 	    SendClientMessage(i,grey,string);
		}
		}
	}
//==============================================================================
// If PlayerName is Banned
//==============================================================================
    if (dUserINT(PlayerName2(playerid)).("Banned") == 1)
    {
    	format(string,sizeof(string),"[ %s has been BANNED. ]",PlayerName2(playerid));
        SendClientMessage(playerid, red, string);
        SendClientMessage(playerid, red, "[ ATTENTION: This name is banned from this server. ]");
        SendClientMessage(playerid, red, "[ NOTE: You should not ban evade. ]");
        SendClientMessage(playerid, red, "[ NOTE: If you have no point of inocence, then don't try to be smart. ]");
        SendClientMessage(playerid, red, "[ NOTE: Don't PM./chat with users or admins about your ban. ]");
        SendClientMessage(playerid, red, "[ ATTENTION: Just type (/q) and go to our forums to post a BAN-APPEAL, You might have done something wrong. ]");
		format(string,sizeof(string),"[ Player %s (Id: %d) has beenAutomatically  Kicked. | Reason: Name Banned. ]",PlayerName,playerid);
		SendClientMessageToAll(red, string);  print(string);
		SaveIn("KickLog",string);  Kick(playerid);
    }
//==============================================================================
// Kick Forbidden Name
//==============================================================================
	if(ServerInfo[NameKick] == 1)
	{
		for(new s = 0; s < BlockedNamesCount; s++)
		{
  			if(!strcmp(BlockedNames[s],PlayerName,true))
			{
	    	format(string,sizeof(string),"[ %s is in our 'Forbidden Name' list. ]",PlayerName2(playerid));
	        SendClientMessage(playerid, red, string);
			SendClientMessage(playerid,red, "[ ATTENTION: Your name is on our Black List, you have been Kicked. ]");
        	SendClientMessage(playerid,red, "[ ATTENTION: Just type (/q) and come with a new username which is not in our ForbiddenName list. ]");
			format(string,sizeof(string),"[ Player %s (Id: %d) has been Automatically Kicked. | Reason: Forbidden Name. ]",PlayerName,playerid);
			SendClientMessageToAll(red, string);
			print(string);
			SaveIn("KickLog",string);
			Kick(playerid);
			return 1;
			}
		}
	}
//==============================================================================
// Kick Forbidden Part of Name
//==============================================================================
	if(ServerInfo[PartNameKick] == 1)
	{
		for(new s = 0; s < BlockedPartNameCount; s++)
		{
			new pos;
			while((pos = strfind(PlayerName,BlockedPartName[s],true)) != -1)
			for(new i = pos, j = pos + strlen(BlockedPartName[s]); i < j; i++)
			{
	    	format(string,sizeof(string),"[ %s is in our 'Forbidden Part Of Name' list. ]",PlayerName2(playerid));
	        SendClientMessage(playerid, red, string);
			SendClientMessage(playerid,red, "[ ATTENTION: Your name is not Allowed on this server, you have been Kicked. ]");
        	SendClientMessage(playerid,red, "[ ATTENTION: Just type (/q) and come with a new username which is not in our ForbiddenPartOfName list. ]");
			format(string,sizeof(string),"[ Player %s (Id: %d) has been Automatically Kicked. | Reason: Forbidden Name. ]",PlayerName,playerid);
			SendClientMessageToAll(red, string);  print(string);
			SaveIn("KickLog",string);  Kick(playerid);
			return 1;
			}
		}
	}
//==============================================================================
// Server Locked
//==============================================================================
	if(ServerInfo[Locked] == 1)
	{
		AccInfo[playerid][AllowedIn] = false;
		SendClientMessage(playerid,red,"[ Server is locked currently. ]");
		SendClientMessage(playerid,red,"[ You have 40 seconds to enter the server Password. ]");
		LockKickTimer[playerid] = SetTimerEx("AutoKick", 40000, 0, "i", playerid);
	}
 	if (ServerInfo[Locked] == 1 && AccInfo[playerid][AllowedIn] == false)
    {
        ShowPlayerDialog(playerid, DIALOG_TYPE_SERVPASS, DIALOG_STYLE_INPUT,
		"Server Locked:", ""COL_WHITE"Enter the password to Access in\n\n"COL_RED"NOTE:"COL_WHITE" If you are not allowed here, so dont try to unlock your access.\n"COL_WHITE"Actions could be taken!", "Access", "Exit");
	}
//==============================================================================
// Register & Login
//==============================================================================
	if(strlen(dini_Get("/eAdmin/Config/aka.txt", tmp3)) == 0)
	dini_Set("/eAdmin/Config/aka.txt", tmp3, PlayerName);
 	else
	{
	    if( strfind( dini_Get("/eAdmin/Config/aka.txt", tmp3), PlayerName, true) == -1 )
		{
  		format(string,sizeof(string),"%s,%s", dini_Get("/eAdmin/Config/aka.txt",tmp3), PlayerName);
	   	dini_Set("/eAdmin/Config/aka.txt", tmp3, string);
		}
 	}
	if(!udb_Exists(PlayerName2(playerid)))
	SendClientMessage(playerid,orange, "[ SERVER: Your account isn't registered. Please register (/"#RegisterCommand"). ]");
	else
	{
 	AccInfo[playerid][Registered] = 1;
	format(file,sizeof(file),"/eAdmin/Accounts/%s.sav",udb_encode(PlayerName));
	new tmp2[256]; tmp2 = dini_Get(file,"Ip");

	if( (!strcmp(tmp3,tmp2,true)) && (ServerInfo[AutoLogin] == 1))
	{
		LoginPlayer(playerid);
		if(AccInfo[playerid][Level] > 0)
		{
			switch(AccInfo[playerid][Level])
			{
				case 1: AdmRank = "Basic Moderator";
				case 2: AdmRank = "Moderator";
				case 3: AdmRank = "Master Moderator";
				case 4: AdmRank = "Administrator";
				case 5: AdmRank = "Master Administrator";
			}
			if(AccInfo[playerid][Level] > 5)
			{
				AdmRank = "Professional Admin";
			}

//==============================================================================
// VIP System
//==============================================================================
			if(AccInfo[playerid][pVip] > 0)
			{
				switch(AccInfo[playerid][pVip])
				{
					case 1: AccType = "Silver";
					case 2: AccType = "Gold";
					case 3: AccType = "Premium";
				}
				format(string,sizeof(string),"[ You have been Automatically Logged in | Account: %s | Level %d ( %s ). ]", AccType, AccInfo[playerid][Level],AdmRank);
				SendClientMessage(playerid,0x00C378AA,string);
			}
			else
			{
				format(string,sizeof(string),"[ You have been Automatically Logged in | Level %d ( %s ). ]", AccInfo[playerid][Level],AdmRank);
				SendClientMessage(playerid,green,string);
			}
//==============================================================================
		}
		else
		{
			if(AccInfo[playerid][pVip] > 0)
			{
				switch(AccInfo[playerid][pVip])
				{
					case 1: AccType = "Silver";
					case 2: AccType = "Gold";
					case 3: AccType = "Premium";
				}
				format(string,sizeof(string),"[ You have been Automatically Logged in | Account Type: %s. ]", AccType);
				SendClientMessage(playerid,0x00C896AA,string);
			}
			else
			{
				format(string,sizeof(string),"[ You have been Automatically Logged in. ]");
				SendClientMessage(playerid,green,string);
			}
		}
  	}
 	else SendClientMessage(playerid, white, "[ That account is registered. ]") &&
	SendClientMessage(playerid, orange, "Please login to access your Account (/"#LoginCommand") if you aren't logged yet.");
	}
 	return 1;
}
//==============================================================================
// Automatic Kick
//==============================================================================
public AutoKick(playerid)
{
	if( IsPlayerConnected(playerid) && ServerInfo[Locked] == 1 && AccInfo[playerid][AllowedIn] == false)
	{
	new string[128];
	SendClientMessage(playerid,grey,"[ You have been Automatically Kicked. | Reason: Server Locked. ]");
	format(string,sizeof(string),"[ Player %s (Id: %d) has been Automatically Kicked. | Reason: Server Locked. ]",PlayerName2(playerid),playerid);
	SaveIn("KickLog",string);
	Kick(playerid);
	SendClientMessageToAll(red, string);
	print(string);
	}
	return 1;
}
Akeem is offline   Reply With Quote
Old 09/02/2018, 01:23 AM   #10
RogueDrifter
High-roller
 
RogueDrifter's Avatar
 
Join Date: Dec 2017
Location: SA-MP Drifting world.
Posts: 1,191
Reputation: 386
Default Re: how to force a command

nope that's not it, show OnPlayerRequestClass
__________________
Quote:
Originally Posted by Andy
I offer paid scripting services, I can do anything except mapping because fuck mapping.

[Github]:Link [Gists]:Link [Forum]:Link [Server]:Link [Discord]:Link


RogueDrifter is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Force a player to run a command BigBrainAFK Scripting Help 16 19/07/2015 09:50 PM
How to force player to write a command? Micius Scripting Help 1 17/07/2013 07:31 PM
How to create Force command /reclass? [REP+] [FoR]EveR Scripting Help 4 02/04/2012 12:59 PM
Is this possible? Force to aim admantis Help Archive 4 24/10/2010 06:40 AM


All times are GMT. The time now is 05:26 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.