Simple Commands
#1

Hello, I would like to show you some simple commands... They're 5 commands. So, if you want, You can be helped right here.

How to make a /kill command.

Remove //Do something here

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	//Do something here
	return 0;
}
Then, you will have to put the command.

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/kill", cmdtext, true, 10) == 0)
        {
            SetPlayerHealth(playerid, 0.0); // It kills the player
            SendClientMessage(playerid, 0xFFFFFFFF, "You have suicided with the command /kill");
            return 1;
        }
	return 0;
}
That's it!

Now, let's make a /healme command!

Код:
if (strcmp("/healme", cmdtext, true, 10) == 0)
	{
		SetPlayerHealth(playerid, 100); // it heals the player to full health.
		SendClientMessage(playerid, 0xFFFFFFFF, "You have successfully healed yourself!");
		return 1;
	}
Let's make a /myweaps command

Код:
if (strcmp("/myweaps", cmdtext, true, 10) == 0)
	{
	        GivePlayerWeapon(playerid, 34, 999999);
		GivePlayerWeapon(playerid, 31, 999999);
		GivePlayerWeapon(playerid, 24, 999999);
		GivePlayerWeapon(playerid, 26, 999999);
		GivePlayerWeapon(playerid, 16, 999999);
		GivePlayerWeapon(playerid, 32, 999999);
		GivePlayerWeapon(playerid, 9, 1);
                SendClientMessage(playerid, 0xFFFFFFFF, "You have taken your weaps !");
		return 1;
	}
Now, let's make a /myskin command!


1. Put in SetPlayerSkin(playerid, your skin id);

2.
Код:
SetPlayerSkin(playerid, 30);
3. Then to send message to him, Do
Код:
SendClientMessage(playerid, 0xFFFFFFFF, "Your skin has been equipped!");
4. For full it's here!


Код:
if (strcmp("/myskin", cmdtext, true, 10) == 0)
	{
		SetPlayerSkin(playerid, 30);
		SendClientMessage(playerid, 0xFFFFFFFF, "Your skin has been equipped!");
		return 1;
	}
Now, we will make a good command!

1. A /rules command!

Код:
	if (strcmp("/rules", cmdtext, true, 10) == 0)
	{
                SendClientMessage(playerid, 0xFFFFFFFF, "1.Always listen to all admins.");
		SendClientMessage(playerid, 0xFFFFFFFF, "2.Do not hack, because it will result in a ban.");
		SendClientMessage(playerid, 0xFFFFFFFF, "3.Do not spamming!");
		SendClientMessage(playerid, 0xFFFFFFFF, "5.Do not insult players");
		SendClientMessage(playerid, 0xFFFFFFFF, "7.Respect players and administrators, especially owners and server heads.");
		SendClientMessage(playerid, 0xFFFFFFFF, "8.Do not abusing!");
		SendClientMessage(playerid, 0xFFFFFFFF, "9.If someone breaks rules, it will result in a ban.");
		SendClientMessage(playerid, 0xFFFFFFFF, "-----------------------------------------------------------------");
		SendClientMessage(playerid, 0xFFFFFFFF, "If anyone disrespect these rules, it will result in a perm ban!");
		SendClientMessage(playerid, 0xFFFFFFFF, "-----------------------------------------------------------------");
		SendClientMessage(playerid, 0xFFFFFFFF, "Thanks for reading these rules, have fun!!! Enjoy the server!!!");
		return 1;
	}

+ REP TO ME IF I HELPED!

If you see any errors, Please post it here!

THANKS
Reply
#2

wtf...
First of all it's not a place to release some commands that are found on the wiki, this place is to ask for help, second to be honest nobody needs that, it's just too simple, third strcmp is slow...
Reply
#3

Post it as a tutorial, man
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)