Make command with 2 slashes // [test] - 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: Make command with 2 slashes // [test] (
/showthread.php?tid=603571)
Make command with 2 slashes // [test] -
ScIrUsna - 25.03.2016
Hi,
How to make (write) command that i could get params when player write 2 slashes not 1 because now in zcmd if i do like this:
Код:
CMD:givemoney(playerid, params[])
{
return 1;
}
i will have to write this command like this: /givemoney
But if i want to make //givemoney
Код:
CMD:/givemoney(playerid, params[])
{
return 1;
}
It give my syntax errors
Re: Make command with 2 slashes // [test] -
SamJust - 25.03.2016
I'm not exactly sure how do u do it in zcmd, but using OnPlayerCommandText is it simple, I guess.... Never tested myself
Re: Make command with 2 slashes // [test] -
ScIrUsna - 25.03.2016
But if i'am using zcmd it's possible to use onplayercommandtext and make that?
Re: Make command with 2 slashes // [test] -
K0P - 25.03.2016
Use "strcmp" under OnPlayerCommandText
Код:
example:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmd, "//imanoob", true))
{
SendClientMessage(playerid, 0xFFFFFF, "Yep!");
}
return 1;
}
Re: Make command with 2 slashes // [test] -
ScIrUsna - 25.03.2016
It's compatible with zcmd?
Re: Make command with 2 slashes // [test] -
UltraScripter - 25.03.2016
When you use zcmd, onplayercommandtext won't work
Re: Make command with 2 slashes // [test] -
UltraScripter - 25.03.2016
try this:
PHP код:
public OnPlayerText(playerid, text[])
{
if(!strcmp("//givemoney", text, true)) //check if player type //givemoney
{
//your code ///////////
return 0; //wont send message: //givemoney
}
return 1;
}
Re: Make command with 2 slashes // [test] -
ScIrUsna - 25.03.2016
it's possible get params? i mean id what he write or name money
//givemoney [player name/id] [money]
Re: Make command with 2 slashes // [test] -
MicroKyrr - 25.03.2016
Quote:
Originally Posted by ScIrUsna
it's possible get params? i mean id what he write or name money
//givemoney [player name/id] [money]
|
Yep , use sscanf2