SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 24/10/2012, 06:19 PM   #1
Hade.
Huge Clucker
 
Hade.'s Avatar
 
Join Date: Oct 2012
Location: Tallinn, Estonia
Posts: 210
Reputation: 16
Post /help command (ZCMD)

So here is a classical command that is needed in pretty much any server, lets get started.

First off the includes. (This is a zcmd command)

PHP Code:
#include <a_samp>
#include <zcmd> 
And the color define that u want, i will use green.

PHP Code:
#define COLOR_GREEN  0x33AA33AA 
Here are many color defines - http://forum.sa-mp.com/showthread.php?t=157789

Next, in your gamemode scroll down and do the CMD.

PHP Code:
CMD:help(playeridcmdtext[]) 
Now you have your command but it dosent do anythind right now, so lets do something.

PHP Code:
{
        
SendClientMessage(playeridCOLOR_GREEN"Your help text");
        
SendClientMessage(playeridCOLOR_GREEN"Your help text");
        
SendClientMessage(playeridCOLOR_GREEN"Your help text");
        
SendClientMessage(playeridCOLOR_GREEN"Your help text");
        
SendClientMessage(playeridCOLOR_GREEN"Your help text");

This send the player all the messages that you write there when he types the /help command
If u need more rows just add one at the bottom, hope i helped you.

Heres the full CMD code if someone dosent understand.

PHP Code:
CMD:help(playerid,params[])
{
        
SendClientMessage(playeridCOLOR_GREEN"Your help text");
        
SendClientMessage(playeridCOLOR_GREEN"Your help text");
        
SendClientMessage(playeridCOLOR_GREEN"Your help text");
        
SendClientMessage(playeridCOLOR_GREEN"Your help text");
        
SendClientMessage(playeridCOLOR_GREEN"Your help text");

__________________
Hade. is offline   Reply With Quote
Old 24/10/2012, 06:27 PM   #2
gtakillerIV
High-roller
 
gtakillerIV's Avatar
 
Join Date: Sep 2011
Location: UAE, Sharjah.
Posts: 1,002
Reputation: 201
Default Re: /help command (ZCMD)

WOW?!

Quote:
public OnPlayerCommandText(playerid, cmdtext[])
{
CMD:help(playerid, cmdtext[])
Really dude?

ZCMD doesn't work inside a callback.

Ex:

PHP Code:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>
#include <zcmd>
#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
    print(
"\n--------------------------------------");
    print(
" Blank Filterscript by your name here");
    print(
"--------------------------------------\n");
    return 
1;
}

public 
OnFilterScriptExit()
{
    return 
1;
}

#else

main()
{
    print(
"\n----------------------------------");
    print(
" Blank Gamemode by your name here");
    print(
"----------------------------------\n");
}

#endif

public OnGameModeInit()
{
    
// Don't use these lines if it's a filterscript
    
SetGameModeText("Blank Script");
    
AddPlayerClass(01958.37831343.157215.3746269.1425000000);
    return 
1;
}

public 
OnGameModeExit()
{
    return 
1;
}

public 
OnPlayerRequestClass(playeridclassid)
{
    
SetPlayerPos(playerid1958.37831343.157215.3746);
    
SetPlayerCameraPos(playerid1958.37831343.157215.3746);
    
SetPlayerCameraLookAt(playerid1958.37831343.157215.3746);
    return 
1;
}

public 
OnPlayerConnect(playerid)
{
    return 
1;
}

public 
OnPlayerDisconnect(playeridreason)
{
    return 
1;
}

public 
OnPlayerSpawn(playerid)
{
    return 
1;
}

public 
OnPlayerDeath(playeridkilleridreason)
{
    return 
1;
}

public 
OnVehicleSpawn(vehicleid)
{
    return 
1;
}

public 
OnVehicleDeath(vehicleidkillerid)
{
    return 
1;
}

public 
OnPlayerText(playeridtext[])
{
    return 
1;
}

public 
OnPlayerCommandText(playeridcmdtext[])
{
    if (
strcmp("/mycommand"cmdtexttrue10) == 0)
    {
        
// Do something here
        
return 1;
    }
    return 
0;
}

public 
OnPlayerEnterVehicle(playeridvehicleidispassenger)
{
    return 
1;
}

public 
OnPlayerExitVehicle(playeridvehicleid)
{
    return 
1;
}

public 
OnPlayerStateChange(playeridnewstateoldstate)
{
    return 
1;
}

public 
OnPlayerEnterCheckpoint(playerid)
{
    return 
1;
}

public 
OnPlayerLeaveCheckpoint(playerid)
{
    return 
1;
}

public 
OnPlayerEnterRaceCheckpoint(playerid)
{
    return 
1;
}

public 
OnPlayerLeaveRaceCheckpoint(playerid)
{
    return 
1;
}

public 
OnRconCommand(cmd[])
{
    return 
1;
}

public 
OnPlayerRequestSpawn(playerid)
{
    return 
1;
}

public 
OnObjectMoved(objectid)
{
    return 
1;
}

public 
OnPlayerObjectMoved(playeridobjectid)
{
    return 
1;
}

public 
OnPlayerPickUpPickup(playeridpickupid)
{
    return 
1;
}

public 
OnVehicleMod(playeridvehicleidcomponentid)
{
    return 
1;
}

public 
OnVehiclePaintjob(playeridvehicleidpaintjobid)
{
    return 
1;
}

public 
OnVehicleRespray(playeridvehicleidcolor1color2)
{
    return 
1;
}

public 
OnPlayerSelectedMenuRow(playeridrow)
{
    return 
1;
}

public 
OnPlayerExitedMenu(playerid)
{
    return 
1;
}

public 
OnPlayerInteriorChange(playeridnewinterioridoldinteriorid)
{
    return 
1;
}

public 
OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    return 
1;
}

public 
OnRconLoginAttempt(ip[], password[], success)
{
    return 
1;
}

public 
OnPlayerUpdate(playerid)
{
    return 
1;
}

public 
OnPlayerStreamIn(playeridforplayerid)
{
    return 
1;
}

public 
OnPlayerStreamOut(playeridforplayerid)
{
    return 
1;
}

public 
OnVehicleStreamIn(vehicleidforplayerid)
{
    return 
1;
}

public 
OnVehicleStreamOut(vehicleidforplayerid)
{
    return 
1;
}

public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    return 
1;
}

public 
OnPlayerClickPlayer(playeridclickedplayeridsource)
{
    return 
1;
}
//Works like this:
CMD:hey(playerid,params[])
{
    
SendClientMessage(playerid , -1"Hello");
    return 
1;

gtakillerIV is offline   Reply With Quote
Old 24/10/2012, 06:38 PM   #3
Hade.
Huge Clucker
 
Hade.'s Avatar
 
Join Date: Oct 2012
Location: Tallinn, Estonia
Posts: 210
Reputation: 16
Default Re: /help command (ZCMD)

Yeah, really sorry for that i messed up but fixed that.
__________________
Hade. is offline   Reply With Quote
Old 24/10/2012, 06:59 PM   #4
HyDrAtIc
High-roller
 
Join Date: Jan 2012
Posts: 1,216
Reputation: 233
Default Re: /help command (ZCMD)

Even no explanations at all?

And only copy and paste and only showing how to make only /help command with no explain,well I would rate this as 2/10.
__________________
Back to service, unbanned.
HyDrAtIc is offline   Reply With Quote
Old 24/10/2012, 07:07 PM   #5
Jarnu
Guest
 
Posts: n/a
Default Re: /help command (ZCMD)

Sorry but a fail
pawn Code:
CMD:help(playerid,params[])
{
        SendClientMessage(playerid, COLOR_GREEN, "Your help text");
        SendClientMessage(playerid, COLOR_GREEN, "Your help text");
        SendClientMessage(playerid, COLOR_GREEN, "Your help text");
        SendClientMessage(playerid, COLOR_GREEN, "Your help text");
        SendClientMessage(playerid, COLOR_GREEN, "Your help text");
{

It will give you error because 2 things

You are not ending the brace.
You are using:
pawn Code:
{

{
Which should be

pawn Code:
{

}

2nd Not returning! else it will give you following after your value.

Code:
SERVER: Unknown command!
pawn Code:
return 1;
  Reply With Quote
Old 27/10/2012, 04:23 PM   #6
lorizz
Big Clucker
 
lorizz's Avatar
 
Join Date: Oct 2012
Posts: 70
Reputation: 4
Default Re: /help command (ZCMD)

sorry but, you are a fail in tutorials :S
__________________
I don't read [+REP] post and [OMGHELP]

5/6,5$ for make you an ENITRE admin system (with slap, splat, banip, unbanip, freeze ecc.) pm me for more infos
10/14$ for make you an ENITRE GM! (Every GM)
lorizz is offline   Reply With Quote
Old 27/10/2012, 04:42 PM   #7
gtakillerIV
High-roller
 
gtakillerIV's Avatar
 
Join Date: Sep 2011
Location: UAE, Sharjah.
Posts: 1,002
Reputation: 201
Default Re: /help command (ZCMD)

You guys SUCK at replying to tutorials....

Instead of depressing him try to make him better!

Read this topic:

http://forum.sa-mp.com/showthread.php?t=371173
gtakillerIV is offline   Reply With Quote
Old 27/10/2012, 05:06 PM   #8
NewerthRoleplay
High-roller
 
NewerthRoleplay's Avatar
 
Join Date: Nov 2011
Location: England :: The Danger Zone
Posts: 1,083
Reputation: 133
Default Re: /help command (ZCMD)

I'd say 1/10 as it is an incredibly simple thing to do and I think every scripting newb had learnt SendClientMessage before anything else, I know I did...
__________________
NewerthRoleplay is offline   Reply With Quote
Old 28/10/2012, 07:23 AM   #9
Silvarray
Little Clucker
 
Silvarray's Avatar
 
Join Date: Sep 2012
Location: Bucharest, Romania
Posts: 33
Reputation: 14
Default Re: /help command (ZCMD)

Here's a tip for the future: only make a tutorial if you know what you are doing.
Nobody's going to appreciate what you do if you fail at it.

Also, test any code that you put in a tutorial.
__________________
Looking for betatesters for a Turf Wars gamemode! PM me if interested.
Awesome person of November: Yuripe!

Silvarray is offline   Reply With Quote
Old 29/10/2012, 08:51 AM   #10
JhnzRep
Huge Clucker
 
JhnzRep's Avatar
 
Join Date: Jan 2012
Location: USA/Slovakia
Posts: 464
Reputation: 65
Default Re: /help command (ZCMD)

I really appreciate you are trying to help the community by creating tutorials, and aren't like "Rep if dis hlpd u at all". I myself am not great at creating tutorials, and they usually lack much explanation...But here are some pointers.

1.Explain - Your tutorial is aimed at newbies, so explain even the simplest functions like "SendClientMessage" in depth.
2.Spelling/Grammar - I don't expect everyone's grammar here to be perfect, as not all of us are from the US. My first language isn't English either, and I have a disorder called dysgraphia which makes me have difficulty with spelling(And if this was handwritten, you probably wouldn't be able to read it)..But my spelling is almost perfect on all my posts? How is this possible? Spellchecker...

Again thank you for trying, and don't let criticism get to you, just take the constructive on learn from it.
__________________
[center]Creations:

[Tutorial]
Business System
JhnzRep 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
[HELP]ZCMD Command! Orhun_Kaya Scripting Help 2 14/07/2012 05:29 PM
ZCMD command. a!DaN)_)-) Server Support 1 13/06/2012 08:23 PM
Executed ZCMD command returns SERVER: Unknown Command SexTourist Scripting Help 12 03/01/2012 04:38 PM
[HELP] ZCMD command. BlackSA Scripting Help 38 26/11/2011 04:14 PM
PM Command for ZCMD Torran Help Archive 7 10/03/2010 03:19 PM


All times are GMT. The time now is 12:30 AM.


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