SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Tutorials

Reply
 
Thread Tools Display Modes
Old 06/05/2012, 01:55 AM   #1
SwiftKidZ
Huge Clucker
 
SwiftKidZ's Avatar
 
Join Date: Apr 2012
Location: Swift GangstaR Town
Posts: 234
Reputation: 13
Thumbs up Simple Things

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
__________________
SwiftKidZ is offline   Reply With Quote
Old 06/05/2012, 03:32 AM   #2
[HiC]TheKiller
High-roller
 
Join Date: Mar 2008
Location: New Zealand
Posts: 2,630
Reputation: 410
Default Re: Simple Things

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 .
__________________
[HiC]TheKiller is offline   Reply With Quote
Old 06/05/2012, 11:17 AM   #3
SwiftKidZ
Huge Clucker
 
SwiftKidZ's Avatar
 
Join Date: Apr 2012
Location: Swift GangstaR Town
Posts: 234
Reputation: 13
Angry Re: Simple Things

Sorry i know it isnt the est tut :/
__________________
SwiftKidZ is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[GameMode] Simple blank script with some things (Dini) Omer_Tabib Gamemode Scripts 18 22/12/2011 10:47 PM
[NGG] [NGRP] Well, So I'll just make a thread to highlight... certain things... to more, set things straight. Sew_Sumi Everything and Nothing 21 03/07/2011 06:29 PM
Simple things shoru93 Help Archive 10 22/01/2010 11:20 PM
Simple things. shoru Help Archive 2 08/11/2009 08:04 PM


All times are GMT. The time now is 08:09 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.