SA-MP Forums Archive
Simple global dcmd command wont 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: Simple global dcmd command wont work -.- (/showthread.php?tid=280026)



Simple global dcmd command wont work -.- - Jack_Leslie - 30.08.2011

pawn Код:
dcmd_g(playerid, params[])
{
new string[128];
if(GetPVarInt(playerid, "Logged") == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You are not logged in!");
new message;
if(sscanf(params,"s",message)) return SendClientMessage(playerid, COLOR_ORANGE, "CMD: /g [message]");
format(string, sizeof(string), "[GLOBAL] %s(%d) says: %s", PlayerName(playerid), playerid, message);
SendClientMessageToAll(COLOR_WHITE, string);
return 1;
}
It just keeps sending "CMD: /g [message]"

It's been a while since I used dcmd style, but this should work -.-


Re: Simple global dcmd command wont work -.- - =WoR=Varth - 30.08.2011

pawn Код:
dcmd_g(playerid, params[])
{
if(GetPVarInt(playerid, "Logged") == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You are not logged in!");
if(sscanf(params,"s[128]",params)) return SendClientMessage(playerid, COLOR_ORANGE, "CMD: /g [message]");
format(params,128, "[GLOBAL] %s(%d) says: %s", PlayerName(playerid), playerid, params);
SendClientMessageToAll(COLOR_WHITE, params);
return 1;
}



Re: Simple global dcmd command wont work -.- - Jack_Leslie - 30.08.2011

Quote:
Originally Posted by varthshenon
Посмотреть сообщение
pawn Код:
dcmd_g(playerid, params[])
{
if(GetPVarInt(playerid, "Logged") == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You are not logged in!");
if(sscanf(params,"s[128]",params)) return SendClientMessage(playerid, COLOR_ORANGE, "CMD: /g [message]");
format(params,128, "[GLOBAL] %s(%d) says: %s", PlayerName(playerid), playerid, params);
SendClientMessageToAll(COLOR_WHITE, params);
return 1;
}
Still sends "CMD: /g [message]" even with something after /g


Re: Simple global dcmd command wont work -.- - =WoR=Varth - 30.08.2011

Seems like nothing wrong there.
Check this code:
pawn Код:
dcmd_asd(playerid, params[])
{
new int;
if(sscanf(params,"d",int)) return SendClientMessage(playerid, COLOR_ORANGE, "CMD: /g [message]");
format(params,128, "%d", int);
SendClientMessageToAll(COLOR_WHITE, params);
return 1;
}



Re: Simple global dcmd command wont work -.- - Jack_Leslie - 30.08.2011

It's not just that command, it's all my commands, it doesn't detect anything after the command.


Re: Simple global dcmd command wont work -.- - =WoR=Varth - 30.08.2011

Do you have the latest sscanf version?


Re: Simple global dcmd command wont work -.- - Jack_Leslie - 30.08.2011

Yep, I sure do. sscanf2 for r5


Re: Simple global dcmd command wont work -.- - =WoR=Varth - 30.08.2011

Have you tried the code I gave? (/asd)


Re: Simple global dcmd command wont work -.- - Jack_Leslie - 30.08.2011

Quote:
Originally Posted by varthshenon
Посмотреть сообщение
Have you tried the code I gave? (/asd)
Yep and it replies with "CMD: /g [message]"


Re: Simple global dcmd command wont work -.- - =WoR=Varth - 30.08.2011

Wait a second, I just read my VM.
You have that code on your OnPlayerCommandText?
I think you should read this:
https://sampwiki.blast.hk/wiki/Fast_Commands#dcmd
https://sampforum.blast.hk/showthread.php?tid=243191