SA-MP Forums Archive
Help! Cmds don't work!! - 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)
+--- Thread: Help! Cmds don't work!! (/showthread.php?tid=603104)



Help! Cmds don't work!! - Paradox90 - 18.03.2016

Hi there,

I started scripting again after i was busy with other things for a long time.
I made a gamemode but my cmds don't work at all. It doesn't say that the server doesn't know the command but it's just blank. It doesn't do the command and also doesn't give me any message.
After i've tried multiple things i got mad and deleted the whole gamemode O.o so i have to start all over again.

I also don't know how to get all skins in the playerclass selection ( don't want to put 300 lines in there :P )
I've ******d it till i dropped almost dead but i didn't find anything that works with the gamemode.

Can someone help me with this? What can i do to make the commands work? And is there any code for the playerclass selection?

Oh and also.. Is there any NEW scripting tutorial? I've only found tutorials from yearssss ago, ******* has some new tuts but still there isn't much.

Thanks in advance!


Re: Help! Cmds don't work!! - Joron - 18.03.2016

Show us One the command u made.. And What show u tutorial?
There are alot of tutorials about making a command no excuse..


Re: Help! Cmds don't work!! - Paradox90 - 18.03.2016

They're all old, isn't it newer nowadays? I remember scripting cmds just the same way i do now, then it worked, now it does nothing.
This is one code i just made 5mins ago, from a yt tut and nope, it doesn't work again -_-

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/help", cmdtext, true, 5) == 0)
{
SendClientMessage(playerid,indigo,"This is a freeroam server");
return 1;
}
return 0;
}


Re: Help! Cmds don't work!! - Paradox90 - 18.03.2016

I was way to long out of this so i have to learn everything step by step again.
That's why i'm following all kinds of tuts for the past 4 days but i just can't get it working tho


Re: Help! Cmds don't work!! - Paradox90 - 18.03.2016

Also.. When i add, for example, an register/login filterscript, the cmds also doesn't work!! So i have absolutely no idea what the problem is here


Re: Help! Cmds don't work!! - DarkLored - 18.03.2016

I think you are supposed to return a 0 on the commands instead of a 1 while using 'strcmp'. The "newer" way that we use today are includes such as ZCMD, YCMD, etc...


Re: Help! Cmds don't work!! - Paradox90 - 18.03.2016

Thanks for your answer. Yesterday i tried scripting the cmd with zcmd and some other plugins that were needed but it still didn't work. I'm getting crazy cause i feel like i've tried everything already.
I'm rn watching a tut from 2010 O.o hopefully this command will work.
The 1 was already in the new script so i just left it there. It's after all these public things so i didn't dare to change it or something :P
Do you think it's better? I'm now scripting a tele cmd while using strcmp and that guy from the vid also uses return 1; ... It's confusing af tho :O wow :P


Re: Help! Cmds don't work!! - Wex56 - 18.03.2016

Well I'll recommend you to use ZCMD. First you have to download it here:https://sampforum.blast.hk/showthread.php?tid=91354

Then put it in your include folder!

After that go in your gamemode and on start put #include <zcmd>

When you're finished put your commands on the end of gamemode after everything

Here is example:
Код:
CMD:help(playerid ,params[])
{
SCM(playerid, COLOR_RED, "/car /askq /report /etc /etc /etc");
return 1;
}
If you need anything else just post and I'll answer.

And yea don't use strcmp it's really old and slow.Use ZCMD like everyone else. ZCMD is the fastest command proccesor around here


Re: Help! Cmds don't work!! - AndySedeyn - 18.03.2016

Here's great reference material: https://sampwiki.blast.hk/wiki/OnPlayerCommandText
Make sure that you're not combining the latest version of ZCMD and OnPlayerCommandText because it won't work then.


Re: Help! Cmds don't work!! - Sew_Sumi - 18.03.2016

Use fast commands, and DON'T mix them.

use the wiki, and real tutorials. Videos are cool, but learning to script is more important than following a video step-by-step where you end up in this situation, where it doesn't work, and you can't read the code so you don't know where it's gone to shit.

Also, with your filterscript, does it NEED to be a filterscript? It can after all simply be put in the gamemode itself.


Quote:
Originally Posted by Wex56
Посмотреть сообщение
Here is example:
Код:
CMD:help(playerid ,params[])
{
SCM(playerid, COLOR_RED, "/car /askq /report /etc /etc /etc");
return 1;
}
This is why people say don't post up untested code... SCM is not defined...


Код:
CMD:help(playerid ,params[])
{
SendClientMessage(playerid, COLOR_RED, "/car /askq /report /etc /etc /etc");
return 1;
}
FTFY