Small dcmd questions! - 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: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Small dcmd questions! (
/showthread.php?tid=74165)
Small dcmd questions! -
Djiango - 20.04.2009
Is it possible to do something like this, in dcmd?
if(strcmp(cmd,"/r",true) == 0 || strcmp(cmd,"/fix",true) == 0 || strcmp(cmd,"/vr",true) == 0)
Also i'm trying to convert this admin cmd, into dcmd. ( Admin chat command! )
if(strcmp(cmd, "//", true) ==0)
But I don't think dcmd likes the "/" Because I get all sorts of errors, when trying to compile?
Any help or advice, is appreciated!
Re: Small dcmd questions! -
MenaceX^ - 20.04.2009
I'm not a dcmd fan but I know how to write a command though.
pawn Код:
//OnPlayerComText
dcmd(/,1,cmdtext); // dcmd creates automaticly one /
// Under OnPlayerCommandText public
dcmd_/(playerid, params[])
That's it I think..
Re: Small dcmd questions! -
Djiango - 20.04.2009
Yep excatly what I did.
Here's the code.
OnPlayerCommandText
dcmd(/, 1, cmdtext);
dcmd function
pawn Код:
dcmd_/(playerid, params[])
{
if(PlayerStuff[playerid][VADMIN] < 1) return DenyMessage(playerid, 1);
new result[128];
if(sscanf(params, "s", result)) return SendClientMessage(playerid, COLOR_BRIGHTRED, "SYNTAX ERROR: Usage: // <text>");
new string[128];
GetPlayerName(playerid, sendername, 24);
format(string,sizeof(string),"Admin: %s (lvl: %d): %s", sendername, PlayerStuff[playerid][VADMIN], result);
for(new i=0;i<PLAYERS;i++)
{
if(IsPlayerConnected(i) && PlayerStuff[i][VADMIN] >= 1)
SendClientMessage(i,COLOR_BLUE,string);
}
return 1;
}
My GM compiles fine without this command.
But with it, I get all sorts of errors, on lines that compiled fine before. So that's why I think dcmd doesn't like symbols as "-" & "/"
But I really want to get it confirmed, before making workarounds.
Re: Small dcmd questions! -
Simon - 20.04.2009
'/' is an character in function names - you simply can't use dcmd for it.
Re: Small dcmd questions! -
Djiango - 20.04.2009
Ah, well I guess I have to do it another way then.
Thanks to the both of you.