Is it possible to : ? -
Osamakurdi - 08.03.2018
Is it possible to add command from game ?
A simple command that send a message only This code:
PHP Code:
CMD:addcommand(playerid, params[])
{
new cmdname[25], textsend[180];
if(sscanf(params, "s[25]s[180]", cmdname, textsend)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE:/addcommand <cmd name> <text that cmd gonna send>");
return 1;
}
For example:
/addcommand <help> <Help isn't available now.>
so cmd help can be added in script and when player type /help it will send him Help isn't available now.
Re: Is it possible to : ? -
ISmokezU - 08.03.2018
Don’t be lazy. This doesn’t even make sense code them separately.
Re: Is it possible to : ? -
SeanDenZYR - 09.03.2018
try checking this out.
showthread.php?t=608474
Re: Is it possible to : ? -
Sew_Sumi - 09.03.2018
This doesn't fit what they are wanting to do...
Seems like an attempt at a dynamic command system, but really, it's flawed in the long run.
Simply do as what ISmokezU said... Simply code the commands, as in the longer term, those commands should be populated later, so you could easily just make...
Code:
CMD:help(playerid)
{
SendClientMessage(playerid, COLOR_WHITE, "Help will be available soon.");
return 1;
}
Re: Is it possible to : ? -
AroseKhanNiazi - 09.03.2018
To be honest I don't think it's gonna be possible. If it is that's really gonna be hard and would be limited too.
Re: Is it possible to : ? -
KayJ - 09.03.2018
Store them in file and load them with texts?
I saw that in a script in some forums and that command does the same thing but limited to that only.
Re: Is it possible to : ? -
Sew_Sumi - 09.03.2018
^^ I remember something similar, yet I searched for it thinking it was "Dynamic Commands" but couldn't find it.
Re: Is it possible to : ? -
Meller - 09.03.2018
This question has very little to none explanation, and those who's said it's impossible slash very hard to, please provide some logic to that? What you're asking to do is create a message response when a client sends the messages which is given in an input. This is very easy in the long run, all you have to do is look at the compability and stability.
The run of this idea is to: register the keyworf '${commandKey}' to a database storage (let it be file storage or MariaDB etc), register another keyword '${commandResponse}'. Then we've got a list of 'commands' defined by a user. Since PAWN is working under the runtime only, we now gotta define this list of commands staticly, to do this you can use the callback of 'OnPlayerCmdText', however. It will depend on how you code this, will you loop over the list of the registered commands, will you pull the data everytime a slash is written, will you use 'if' statements, and so on. All of those examples are bad practice, keep that in mind. I believe this is enough to get you on track.
for the love of god, don't ask me for code.