change nick command
#1

Heeeey People,
Can someone make a script for me?
When i (AS ADMIN) typ:
/aperm playerid and then give that player premission to chhange his name.
only rcon logged admin
This is what i want?
So please can someone fix it for me
Reply
#2

Do you have already code for that? If so, show it. Or do you want someone to write you a whole /changenick command?

If you aren't very newbie, you can add it on your own? Use IsPlayerAdmin.
Reply
#3

i have the beginning and that is only for player selfs use
i want that i as admin can GIVE it to an other..
Tonight is post the code what i have
Reply
#4

This is what i got:

Код:
	if (strcmp("/aperm", cmdtext, true, 10) == 0)
	{
		ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Change your nickname","You can enter here a new nickname:","Accept","Nevermind");
	return 1;
	}
	

	public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
	{ 
	if(dialogid == 2 && response)
	{
	SetPlayerName(playerid,inputtext);
Now i want that this is a Admin Command And i want it to GIVE TO ANOTHERE PLAYER!

SO how to fix that?
Reply
#5

yeah, I want too know it too
Reply
#6

The code is quite easy and I am sure you can do it on your own:

Create a command expecting a playerid/playername and a string. Inside the command, check whether the player is an admin (with whatever indicator you use for that), if he is you can use SetPlayerName just as well.

One suggestion in general: Directly switch to dcmd/zcmd when you are just about to learn scripting.

At SA-MP wiki you can find lots of information about it.
Reply
#7

Im a nub in scripting so please? can u make it for me?

This is what i got and then?

Код:
dcmd_changenick(playerid,params[])
{
if (PlayerInfo[playerid][pAdmin] >= 20)
{
return 1;
}
Reply
#8

Alright, that's good to start off with

Now check out the wiki article about dcmd:

https://sampwiki.blast.hk/wiki/Dcmd#dcmd

You find perfect explanations in there how to ask for a playerid/playername and a string to be given as a command parameter.

Next step is to simply change the name of the playerid passed as a parameter to the string passed as a parameter.

Of course you should check for common problems, such as:

Is the player connected?

Does the string include characters which are not supposed to be in the playername?

And so on...

Give it a try
Reply
#9

God Deam im not comming out? What to put @ ID?
PLEASE make it for me?
Please?

This code i now have:

Код:
dcmd_changename(playerid, params[])
{
if (PlayerInfo[playerid][pAdmin] >= 20)
{
return 1;
}
if (strlen(params))
{
id = strval(params);
if (IsPlayerConnected(id))
{
ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Change your nickname","You can enter here a new nickname:","Accept","Nevermind");
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "Player not found");
}
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/changename <playerid>\"");
}
return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 2 && response)
{
SetPlayerName(playerid,inputtext)
Reply
#10

Код:
dcmd_changename(playerid, params[])
{
#pragma unused params
if (!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,0xFF0000AA,"You are not authorized to use that!");
{
if (!IsPlayerConnected(playerid)) return SendClientMessage(playerid, 0xFF0000AA, "Player not found");
{
ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Change your nickname","You can enter here a new nickname:","Accept","Nevermind");
}
}
return 1;
}
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if(dialogid == 2 && response)
	{
		SetPlayerName(playerid,inputtext);
	}
  return 1;
}
Im pretty sure it works. Not tested.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)