Any ideas?
#1

Hello, i want to create a command that when i type /makemegod it pops up with a dialog and you need to insert a pass like 2413 and it will give you 9999 admin level any ideas?
Reply
#2

Make a variable like
pawn Code:
new password = 2413;
...then make a command which show's a dialog to the player; https://sampwiki.blast.hk/wiki/ShowPlayerDialog ...

...then under OnDialogResponse, check if the players input is that "new password", if it is, give him admin rights etc...

Hope this helps!
Reply
#3

Hmm, why dont you make a commands like /god, instead of doing /makemegod. I'll give you this

CMD:god(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 2)
{
SetPlayerHealth(playerid, 100000);
SetPlayerArmour(playerid, 100000);
}
return 1;
}



If i helped you. Please give me reps, thanks.
Reply
#4

Quote:
Originally Posted by Dean_Nelson
View Post
Hmm, why dont you make a commands like /god, instead of doing /makemegod. I'll give you this

CMD:god(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 2)
{
SetPlayerHealth(playerid, 100000);
SetPlayerArmour(playerid, 100000);
}
return 1;
}



If i helped you. Please give me reps, thanks.
This haves NOTHING to do what OP asked for... And stop begging reps. -.-
Reply
#5

Was this request solved?
Reply
#6

Code:
new pass[32] = "36543532";
Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/makemegod", cmdtext, true, 10) == 0)
	{
		ShowPlayerDialog(playerid, 334, DIALOG_STYLE_INPUT, "Admin", "Enter the password below:", "Accept", "Cancel");
		return 1;
	}
	return 0;
}
Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if(dialogid == 334)
	{
	    if(!response)
	    {
	        return 1;
	    }
	    else
	    {
	        if(strcmp(inputtext, pass, true))
	        {
	            SendClientMessage(playerid, COLOR_RED, "Wrong password!");
	            return 1;
	        }
	        PlayerInfo[playerid][Admin] = 9999; // Change this to whatever defines your admin level.
	    }
	}
	return 1;
}
Haven't tested it, but you get the idea.
Reply
#7

Quote:
Originally Posted by Shetch
View Post
Code:
new pass[32] = "36543532";
Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/makemegod", cmdtext, true, 10) == 0)
	{
		ShowPlayerDialog(playerid, 334, DIALOG_STYLE_INPUT, "Admin", "Enter the password below:", "Accept", "Cancel");
		return 1;
	}
	return 0;
}
Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if(dialogid == 334)
	{
	    if(!response)
	    {
	        return 1;
	    }
	    else
	    {
	        if(strcmp(inputtext, pass, true))
	        {
	            SendClientMessage(playerid, COLOR_RED, "Wrong password!");
	            return 1;
	        }
	        PlayerInfo[playerid][Admin] = 9999; // Change this to whatever defines your admin level.
	    }
	}
	return 1;
}
Haven't tested it, but you get the idea.
Sorry but i have to bully you for your style of making dialogs. Whats with the "if(!response)", you can just remove the '!' and continue your script there, no 'else' needed. Bwah.
Reply
#8

Example
pawn Code:
new pass = 1234;//Create a password variable to password this in your command.
wiki.sa-mp.com/wiki/OnDialogResponse
Here you'll get an idea to create your /god command.

Im sorry for not explaining how to do this because Im now using forums in mobile,so I dont know whether Im typing correct or not.
Reply
#9

Quote:
Originally Posted by ddnbb
View Post
Sorry but i have to bully you for your style of making dialogs. Whats with the "if(!response)", you can just remove the '!' and continue your script there, no 'else' needed. Bwah.
Each person has their own style of scripting I guess.
I just like it better that way.
Reply
#10

Quote:
Originally Posted by Shetch
View Post
Each person has their own style of scripting I guess.
I just like it better that way.
Thats for sure. But makes me wonder why would someone like to make useless few lines of script.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)