[Tutorial] /help command (ZCMD)
#1

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");

Reply
#2

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;

Reply
#3

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

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.
Reply
#5

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
#6

sorry but, you are a fail in tutorials :S
Reply
#7

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
Reply
#8

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...
Reply
#9

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.
Reply
#10

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


Forum Jump:


Users browsing this thread: 2 Guest(s)