Is it possible to : ?
#1

Is it possible to add command from game ?
A simple command that send a message only This code:
PHP Code:
CMD:addcommand(playeridparams[])
{
    new 
cmdname[25], textsend[180];
    if(
sscanf(params"s[25]s[180]"cmdnametextsend)) return SendClientMessage(playeridCOLOR_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.
Reply
#2

Don’t be lazy. This doesn’t even make sense code them separately.
Reply
#3

try checking this out.
showthread.php?t=608474
Reply
#4

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; 
}
Reply
#5

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.
Reply
#6

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.
Reply
#7

^^ I remember something similar, yet I searched for it thinking it was "Dynamic Commands" but couldn't find it.
Reply
#8

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)