PDA

View Full Version : commands in the console?!


NicholasA
27/05/2013, 05:20 PM
public OnRconCommand(cmd[])
{
if(!strcmp(cmd,"help",true))
{
clearconsole();
print("Welcome to the admin control panel of guards vs the assassin!");
print("The server is can be fully controlled in this window!");
print("Your commands are the following:");
print("clearconsole, ");
return 1;
}
else if(!strcmp(cmd,"clearconsole",true))
{
clearconsole();
return 1;
}
return 0;
}

When i type "help" nothing happens same thing for "clearconsole"

Blackazur
27/05/2013, 05:40 PM
try that

public OnRconCommand(cmd[])
{
if(strcmp(cmd,"help",true))
{
clearconsole();
print("Welcome to the admin control panel of guards vs the assassin!");
print("The server is can be fully controlled in this window!");
print("Your commands are the following:");
print("clearconsole, ");
return 1;
}
else if(!strcmp(cmd,"clearconsole",true))
{
clearconsole();
return 1;
}
return 0;
}

Hernando
27/05/2013, 05:43 PM
Don't use that as it will clear it if you do /help, and it doesn't actually register the /clearconsole CMD, try this:

public OnRconCommand(cmd[])
{
if(!strcmp(cmd,"help",true))
{
print("Welcome to the admin control panel of guards vs the assassin!");
print("The server is can be fully controlled in this window!");
print("Your commands are the following:");
SendRconCommand("clearconsole");
return 1;
}
if(!strcmp(cmd,"clearconsole",true))
{
clearconsole();
return 1;
}
return 0;
}

Scenario
27/05/2013, 05:43 PM
http://wiki.sa-mp.com/wiki/OnRconCommand

Strcmp returns 0 if the strings are the same, so that code won't work Blackazur.

Hernando
27/05/2013, 05:46 PM
@RealCop228
1: Sorry for getting mad about your posts, that was very childish of me. I shouldn't have asked for that from you guys.
2: In the code I gave him it's if(!strcmp(cmd, "CMD", true)) as I know it returns 0 if they are the same.

NicholasA
28/05/2013, 11:16 AM
Still doesnt work guys :x please help