Command help! Easy for pro's!
#1

Ok, I have a simple MoveObject command, it works really good, nothing bad with it, but how can I do so ONLY names that I write in the script can use the command?

This is for a clan, an example:

I am logged into RCON with name Admin, I type

"/opengarage" - "ERROR: Unknown command"

Then I log into normal with a name like ClanMember1, then I type the same
"/opengarage" - "Garage is opening" then it opens.

How can I do it? Here is the code:

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp(cmdtext, "/GarageOpen", true)==0)
	{
	  MoveObject (door, 1460.2858886719, -2214.7924804688, 8.5460910797119, 5);
	  SendClientMessage(playerid, 0x0000000F, "Clan garage is now opening");
	  return 1;
	}
	  if (strcmp(cmdtext, "/GarageClose", true)==0)
	{
	  MoveObject (door, 1460.2858886719, -2214.7924804688, 14.546091079712, 5);
	  SendClientMessage(playerid, 0x0000000F, "Clan garage is now closing.");
	  return 1;
	}
	  return 0;
}
I don't want everybody to open it. Let's say I add a list with ClanMember1, Owner23232, Mark142432323, Gangster2323323 and the list goes on

Can someone help me? I have searched the whole forum and can't find it.

Here is the WHOLE script.

Код:
#include <a_samp>
#define FILTERSCRIPT
#if defined FILTERSCRIPT

//new hall;
new door;
//new door_closed; Used for the closed position
//new door_open; Used for rhe open position

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print("      Dave's clan garage enabled      ");
	print("--------------------------------------\n");
	CreateObject(8947, 1448.0778808594, -2214.7619628906, 15.599655151367, 0.000000, 0.000000, 90); //hall
	door = CreateObject(16773, 1460.2858886719, -2214.7924804688, 14.546091079712, 0.000000, 0.000000, 90); //door
	//door_closed = CreateObject(16773, 1460.2858886719, -2214.7924804688, 14.546091079712, 0.000000, 0.000000, 90); //door_closed
	//door_open = CreateObject(16773, 1460.2858886719, -2214.7924804688, 8.5460910797119, 0.000000, 0.000000, 90); //door_open
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

#else
#endif

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp(cmdtext, "/GarageOpen", true)==0)
	{
	  MoveObject (door, 1460.2858886719, -2214.7924804688, 8.5460910797119, 5);
	  SendClientMessage(playerid, 0x0000000F, "Clan garage is now opening");
	  return 1;
	}
	  if (strcmp(cmdtext, "/GarageClose", true)==0)
	{
	  MoveObject (door, 1460.2858886719, -2214.7924804688, 14.546091079712, 5);
	  SendClientMessage(playerid, 0x0000000F, "Clan garage is now closing.");
	  return 1;
	}
	  return 0;
}
Just add 4 names as default, then I will find out how to add.

Add so the name "Dave/dave" may open, then "Kayla" or "kayla", "jack" and "jacket". But make so peoples name can be like mYnAME and MyName.
Reply
#2

I am like looking for a script so only the "Names" that is added may use the command, nobody else. Even not "King2" if only "King" is written.
Reply
#3

Seriously, can nobody help?
Reply
#4

Код:
if (strcmp(cmdtext, "/GarageOpen", true)==0)
{
new Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, sizeof(Name));
if(strcmp( Name, "your name","second name"))
{
MoveObject (door, 1460.2858886719, -2214.7924804688, 8.5460910797119, 5);
SendClientMessage(playerid, 0x0000000F, "Clan garage is now opening");
}
return 1;
}

if (strcmp(cmdtext, "/GarageClose", true)==0)
{
new Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, sizeof(Name));
if(strcmp( Name, "your name","second name"))
{
MoveObject (door, 1460.2858886719, -2214.7924804688, 14.546091079712, 5);
SendClientMessage(playerid, 0x0000000F, "Clan garage is now closing.");
}
return 1;
}
put this on your command!!!

not tested!!!
Reply
#5

*Edited* Helped with something else
Reply
#6

Quote:
Originally Posted by Gilardo
Making the good one, please wait

Edited
Make what huh?
Reply
#7

Код:
GetPlayerName(playerid, Name, sizeof(Name));
f(strcmp( Name, "your name"))
{
you command code
}
put this on your command!!!

not tested!!!

[/quote]

It helped a bit, but I really don't know how to add more names, and either not how to make it in OnPlayerCommand.
Reply
#8

look again i update it!
Reply
#9

Quote:
Originally Posted by billiout
look again i update it!
What's the point in writing that you are updating?

What is updated? I need the script, not someone saying something about update blabla.
Reply
#10

Quote:
Originally Posted by Kidel
Код:
GetPlayerName(playerid, Name, sizeof(Name));
f(strcmp( Name, "your name"))
{
you command code
}
put this on your command!!!

not tested!!!
It helped a bit, but I really don't know how to add more names, and either not how to make it in OnPlayerCommand.
[/quote]
pawn Код:
new PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
if(!strfind(PlayerName, "[your name here]", true) return 0;
if(strfind(PlayerName, "[your name here]", true)
{
    Command Code here
    return 1;
}
Try this
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)