Params and OnRconCommand - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Params and OnRconCommand (
/showthread.php?tid=275391)
Params and OnRconCommand -
iTorran - 09.08.2011
Is there anything similar to params in OnRconCommand?
So you can e.g. type "msg hello!" into the console and ingame will be transmitted "hello!"
Re: Params and OnRconCommand -
StR_MaRy - 09.08.2011
i am not sure for this you ar not in counter-strike
Respuesta: Params and OnRconCommand -
RatHack - 09.08.2011
In console: say hello
Re: Respuesta: Params and OnRconCommand -
iTorran - 09.08.2011
Quote:
Originally Posted by RatHack
In console: say hello
|
I know, that was just an example. If there was an equivelent then i would use it for something like..
restart [time]
Re: Params and OnRconCommand -
Stylock - 09.08.2011
I'll show you few examples with sscanf:
pawn Код:
public OnRconCommand(cmd[])
{
if(!strcmp(cmd, "msg", false, 3))
{// length of "msg" ^
new
msg[128],
user;
if(sscanf(cmd[3], "us[128]", user, msg))
{// ^ length of "msg"
print("SYNTAX: msg [user] [message]");
return 1;
}
if(user != INVALID_PLAYER_ID)
{
SendClientMessage(user, -1, msg);
}
else
{
print("ERROR: player is not connected.");
}
return 1;
}
if(!strcmp(cmd, "restart", false, 7))
{// length of "restart" ^
new
time;
if(sscanf(cmd[7], "d", time))
{// ^ length of "restart"
print("SYNTAX: restart [time]");
return 1;
}
printf("SERVER: server will restart in %d seconds.", time);
SetTimer("Rcon_Restart", time * 1000, false);
return 1;
}
return 1;
}
OK, now you should understand how to get parameters from cmd.
Re: Params and OnRconCommand -
iTorran - 09.08.2011
Perfect! Thanks