Define and CMD
#5

If what your asking is how to make a command that only a drug dealer in your server can use, yes that is possible. You can do it by doing this:

At the top of your script you should see a:
Код:
#endif
Under that text type:
Код:
new gTeam[MAX_PLAYERS];

#define GANG_DRUGDEALER 1 //This is where you define the drug dealer
If its not under the #endif, you will get an error code later on. I don't know why but you just do.

Next you need to make the command:

Код:
if (strcmp("/drugdealer", cmdtext, true, 10) == 0)
	{
	if(gTeam[playerid] == GANG_DRUGDEALER) { // Using this command will check if the player is a drug dealer.
	SendClientMessage(playerid, 0, "You are a drug dealer."); //Type whatever you want to say here.
         //Type your command here for what you want it to do, like giving the player drugs, or whatever.
	return 1; } //Closing the if drug dealer command.
        }
How to set a player as a drugdealer:

//You are going to need something like zcmd to do this, but for the purpose of showing you how to do it, im just going to be showing me doing it to myself using strcmp.

Код:
if (strcmp("/setdrugdealer", cmdtext, true, 10) == 0)
        {
        gTeam[playerid] = GANG_DRUGDEALER; //This sets the players team to drug dealer.
	SendClientMessage(playerid, 0, "You are now a drug dealer."); //Tells the player he is a drug dealer.
	}
If you get any errors, just ask.
Reply


Messages In This Thread
Define and CMD - by Lajko1 - 16.03.2014, 12:27
Re : Define and CMD - by anou1 - 16.03.2014, 12:33
Re : Define and CMD - by Golimad - 16.03.2014, 12:35
Re: Define and CMD - by Lajko1 - 16.03.2014, 12:53
Re: Define and CMD - by Ciarannn - 16.03.2014, 13:35
Re: Define and CMD - by Lajko1 - 16.03.2014, 14:20
Re: Define and CMD - by Abagail - 16.03.2014, 14:23
Re: Define and CMD - by Ciarannn - 16.03.2014, 14:27
Re: Define and CMD - by Lajko1 - 16.03.2014, 14:34

Forum Jump:


Users browsing this thread: 4 Guest(s)