[Tutorial] Simple Things
#1

Hey
i am gonna show how to make a simple command will its SIMPLE

Code:
#define BLUE		0x0000FFAA
#define PINK        0xFF66FFAA
#define BLACK      	0x000000AA
#define AQUA        0x7CFC00AA
#define LIGHTBLUE   0x00BFFFAA
#define YELLOW      0xFFFF00AA
#define WHITE      	0xFFFFFFAA
#define WHITEP 		0xFFFFD5AA
#define GREY        0xAFAFAFAA
#define RED        	0xFF0606AA
#define CYAN        0x99FFFFAA
#define GREEN 		0x21DD00FF
#define ORANGE      0xF97804AA
#define PURPLE      0x9900FFAA
#define ADMIN_RED 	0xFB0000FF
#define LIGHTGREEN 	0x38FF06FF
#define COLOR_LIMEGREEN 0x32CD32FF


public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/mycommand", cmdtext, true, 10) == 0)
	{
		// Do something here
		return 1;
	}
	return 0;
should be like that NOTE! the colors use in a line like SendClientMessage(playerid, 0x0000FFAA, "YOUR TEXT");
i use color blue "#define BLUE 0x0000FFAA" Now i will tell in more detail


Code:
if (strcmp("/mycommand", cmdtext, true, 10) == 0)
if (strcmp("/mycommand", cmdtext, true, 10) == 0) that is a command like /help , /credits , /cmds , /teles any of those commands

Code:
f (strcmp("/mycommand", cmdtext, true, 10) == 0)
	{
		// Do something here
		return 1;
	}
Where says
Code:
 //Do something here
you can put any of these one you need
Code:
SendClientMessage(playerid, COLOR,"this will just send client message to the player used for

f (strcmp("/COMMAND HERE", cmdtext, true, 10) == 0)
	{
		SendClientMessage(playerid, COLOR,"this what slinet message used for will only send the player the message");
		return 1;
	}
Now SendClientMessageToAll()

Code:
SendClientMessageToAll() will send all players the command great for /fakeban >:D heres a e.g.

f (strcmp("/fakeban", cmdtext, true, 10) == 0)
	{
		SendClientMessageToAll(playerid, 0xFF0606AA,"You have been banned from the server");
                SendClientMessageToAll(playerid, 0xAFAFAFAA,"server closed connection");
		return 1;
	}
will its just like really geting banned pretty funny

Hope the tut helped

Wont be the best tut :/


Secound Tut first one wasnt good hope i done better
By SwiftKidZ
Reply
#2

Here are a few errors in your tutorial:
1. First section of code is missing a closing bracket under OnPlayerCommandText.
2. On all of the command checks, you have something like this:
pawn Code:
f (strcmp("/COMMAND HERE", cmdtext, true, 10) == 0)
You're missing the 'i' on 'if'.
3. If you look at this line:
pawn Code:
SendClientMessageToAll(playerid, 0xFF0606AA,"You have been banned from the server");
You seem to have playerid. Playerid isn't needed in SendClientMessageToAll as it doesn't have a param for it (sends to everyone rather than a single player).

4. You have random snippets of code everywhere, not sure what you're trying to do with them. If you're trying to explain something, use comments (//).

5. This line:
pawn Code:
SendClientMessage(playerid, COLOR,"this will just send client message to the player used for
There is no closing quote / bracket and no valid colour.

Your explanations are pretty hard to follow, someone new at PAWN may have trouble reading this tutorial and understanding it properly.

Just a bit of constructive criticism .
Reply
#3

Sorry i know it isnt the est tut :/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)