SA-MP Forums Archive
[Tutorial] Some Commands ! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] Some Commands ! (/showthread.php?tid=235261)



Some Commands ! - Roomeo - 05.03.2011

This Is My First Tutorial In THis Tut i will Show You How TO Add /Rules /kill /Commands /credits And /Heal

first /Rules OK Let's Get Started....

pawn Code:
//Colors
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_BRIGHTRED 0xFF0000AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_PINK 0xFF66FFAA
#define COLOR_BLUE 0x3A47DEFF
#define COLOR_TAN 0xBDB76BAA
#define COLOR_PURPLE 0x800080AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_INDIGO 0x4B00B0AA
#define COLOR_BLACK 0x00000000
#define COLOR_DARKGREY 0x696969FF
Ofc you Can Change The Colours If DARKGREY copy it's Code 0x696969FF Or Blue Copy It's Code .....
OnPlayerCommandText

pawn Code:
if(strcmp(cmdtext, "/rules", true, 10) == 0)
{
//Now TO SHow The Players Rules Do This!
pawn Code:
SendClientMessage(playerid, 0xFF0000AA,"   Rules"); //The player Will See Rules On The First Line.
SendClientMessage(playerid, 0xFF0000AA,"<> Do Not Ask To Be Admin. We Choose Admins!");
SendClientMessage(playerid, 0xFF0000AA,"<> Do Not Break The Rules You Can Get Punished"); // You Can Add More rules You Just Need To Do What i did SendClientMessage(playerid, Colour," Rule.
//And In The End
return 1;
} // Bracket

// Second Thing /kill It's Very Easy.

And yes You Need if(strcmp(cmdtext, "/rules", true, 10) == 0) it's Very Important
pawn Code:
if (strcmp("/Kill", cmdtext, true, 10) == 0) // like i said important Thing
{ // and Bracket
SetPlayerHealth(playerid, 0); // This will Set Player Hp To 0 and He Will Die
SendClientMessage(playerid, COLOR_BRIGHTRED, "You Killed Yourself!");// Message To Player
return 1; // And Yes this is also Important you need to place it in The End
}// Bracket :)
More Comming Soon..

Sorry For My Fails :P


Re: Some Commands ! - ilikenuts - 05.03.2011

good, i'll make a tut about some commands and take some from it


Re: Some Commands ! - alpha500delta - 05.03.2011

That is it?

By the way, why all those defines, you are using HEX codes in /rules, so why the defines, you obviously copied it from somewhere >.<


Re: Some Commands ! - ilikenuts - 05.03.2011

haaaaaaaaaaahahahahhahahaaa i would to ask him too!!!!
He put all this defines and he didnt even type one from them. aahhahahaaaaaaaaahahahhahahaha!!!!!


Re: Some Commands ! - Roomeo - 05.03.2011

HEX Codes? :S
I Have Maded it My Self i'm Beginner Scripter and Learning Script can you Tell me From Where I Copied? And about More comming Soon i wanted to do it in One Time But i had to Go to Store :P
NeverMind :O Or You want to Tell Me Something ANother?


Re: Some Commands ! - alpha500delta - 05.03.2011

Yes, HEX codes, those 0xFFFF00FF codes. You defined them into all kinds of colors but you never used those defines like ilikenuts said


Re: Some Commands ! - jamesbond007 - 05.03.2011

SendClientMessage(playerid, COLOR_BRIGHTRED, "You Killed Yourself!");//

u call that not using?


Re: Some Commands ! - -Rebel Son- - 05.03.2011

Ok man, I don't know if you copied any of it, but you obviously don't know alot about PAWN. Your defining Colors with HEX Codes. and you don't know what they are, and your not using them.

Code:
if(!strcmp(cmdtext,"/kill",true)) {
SetPlayerHealth(playerid, 0);
SendClientMessage(playerid, COLOR_DEFINE, "You killed your ass");
return 1;}
Is a faster way to do it. Theres a happy'r way. :P


Re: Some Commands ! - Kwarde - 05.03.2011

Quote:

if (strcmp("/Kill", cmdtext, true, 10) == 0) // like i said important Thing

Why is it important? Why is there a ,10 after the "true"? How does it work?
This is more a copy paste tutorial. Explain more!


Re: Some Commands ! - Mean - 06.03.2011

Quote:
Originally Posted by Kwarde
View Post
Why is it important? Why is there a ,10 after the "true"? How does it work?
This is more a copy paste tutorial. Explain more!
I guess everyone knows what that ,10 is. It should be 4 not 10 tho.
It's the LENGTH of the command, like in DCMD, but DCMD is excluding the "/".