Help me. -
Randomai - 15.02.2011
Im creating server and i need /help command.like with this command you can ask help from admins.
I dont know how to do it, so can someone do it to me?im giving credit to that who make it to me, thanks
i want it to be something like this:
Код:
if(strcmp(cmd, "/help", true) == 0)
{
SendClientMessage(playerid, ERROR, "Use: /help [MESSAGE]");
{
SendClientMessageToAdmins(string);
SendClientMessage(playerid, GREEN, "You Message Has Been Sent To Online Admins.");
Re: Help me. -
Niixie - 15.02.2011
You have to tell us how you define the admins, is it enum or something like that or is it just rcon admins?
Re: Help me. -
xir - 15.02.2011
Use zcmd/dcmd with sscanf, it is alot faster
here it is with zcmd plus sscanf
pawn Код:
COMMAND:help(playerid, params[])
{
new string[135], cmdtext[3];
if(sscanf(params, "s[135]", cmdtext[2])) return SendClientMessage(playerid, ERROR, "Usage: /help [MESSAGE]");
format(string, 135, "( HELP ) %s (ID: %d): %s",PlayerName(playerid),playerid, cmdtext[2]);
SendClientMessageToAdmins(string);
SendClientMessage(playerid, GREEN, "Your Message Has Been Sent To Online Admins.");
return 1;
}
Re: Help me. -
Randomai - 15.02.2011
@Niixie, my admins are in my gamemode so idk.it is just SendClientMessageToAdmins(string);
@xir can u make that command strcmp / cmd or something.[if(strcmp(cmd, "/help", true) == 0)]
Re: Help me. -
Steven82 - 15.02.2011
No learn DCMD or ZCMD, it's easier and better. May look harder at first but it really isn't
Re: Help me. -
Randomai - 15.02.2011
okay Steven, tell me where i put that xir's command?
Re: Help me. -
xRyder - 15.02.2011
First you need to include ZCMD and sscanf.(If you haven't done it yet)
And then you just put this command on the bottom of your script.
Re: Help me. -
Steven82 - 15.02.2011
Look
here. This is a simple tutorial/guide i guess
Re: Help me. -
Randomai - 15.02.2011
well i guess my brains are too little to learn
but this is my code now:
Код:
if(strcmp(cmd, "/help", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(strlen(tmp) == 0) return SendClientMessage(playerid, ERROR, "Use: /help [MESSAGE]");
new string[250];
format(string, sizeof(string), "[ ! ] %s[ID:%d] asks help:%s", name, playerid, strlen(tmp));
SendClientMessageToAdmins(string);
SendClientMessage(playerid, GREEN, "You Message Has Been Sent To Online Admins.");
}
Re: Help me. -
Randomai - 15.02.2011
and my problem is....when i do /help how to use car?
it says: [ ! ] Paul_Newton asks help: ow
but if i write: /help howtousecar?
it says: [ ! ] Paul_Newton asks help: owtousecar