SA-MP Forums Archive
[Tutorial] /help command (ZCMD) - 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] /help command (ZCMD) (/showthread.php?tid=387405)



/help command (ZCMD) - Hade. - 24.10.2012

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 - https://sampforum.blast.hk/showthread.php?tid=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");




Re: /help command (ZCMD) - gtakillerIV - 24.10.2012

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;




Re: /help command (ZCMD) - Hade. - 24.10.2012

Yeah, really sorry for that i messed up but fixed that.


Re: /help command (ZCMD) - HyDrAtIc - 24.10.2012

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.


Re: /help command (ZCMD) - Jarnu - 24.10.2012

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;



Re: /help command (ZCMD) - lorizz - 27.10.2012

sorry but, you are a fail in tutorials :S


Re: /help command (ZCMD) - gtakillerIV - 27.10.2012

You guys SUCK at replying to tutorials....

Instead of depressing him try to make him better!

Read this topic:

https://sampforum.blast.hk/showthread.php?tid=371173


Re: /help command (ZCMD) - NewerthRoleplay - 27.10.2012

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...


Re: /help command (ZCMD) - Silvarray - 28.10.2012

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.


Re: /help command (ZCMD) - JhnzRep - 29.10.2012

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.