SA-MP Forums Archive
Question about commands - 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)
+--- Thread: Question about commands (/showthread.php?tid=628088)



Question about commands - Brooks1 - 05.02.2017

Is there a way to force a player to run a specific command ?

For example I want ID 0 to run the command /help without the player typing the command.


Re: Question about commands - GoldenLion - 05.02.2017

I think you could do this:
Код:
OnPlayerCommandText(0, "/help");



Respuesta: Question about commands - HidroDF - 05.02.2017

Код:
new IsNew[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
    IsNew[playerid] = 1;
}

public OnPlayerSpawn(playerid)
{
    if(IsNew[playerid] == 1)
    {
        // If you are using ZCMD
        cmd_help(playerid,"");
     }
}

public OnPlayerDisconnect(playerid, reason)
{
    IsNew[playerid] = 0;
}



Re: Question about commands - Brooks1 - 05.02.2017

Thanks both of you. My idea was for example there is troll hack with /sk command. When player type this command it doesn't send to the server and I want to force the player to type this command to see will the server receive the command from this player, but this doesn't work. Any other ideas?


Re: Question about commands - GoldenLion - 05.02.2017

Quote:
Originally Posted by Brooks1
Посмотреть сообщение
Thanks both of you. My idea was for example there is troll hack with /sk command. When player type this command it doesn't send to the server and I want to force the player to type this command to see will the server receive the command from this player, but this doesn't work. Any other ideas?
Client commands are client commands and server commands are server commands. It's not possible to detect that as far as I know.


Re: Question about commands - JesterlJoker - 05.02.2017

If you want to use that use SCMD.

It sets your commands with an id of itself...

example you can set that admins will see that player is using cmd id 3 which /help.

You just need to set that if(cmdid == 3) or switch cmdid, it depends on your preference.
{
foreach(new i : Player)
if(i is admin) you already know what it needs.
SendClientMessage(i, COLOR, "This player used this command.") <- this should be formatted but I know you understand.

You get the example?

if this is not what you meant then I'm sorry but I think to thing you want to do might be possibpe but not at this generation.


Re: Question about commands - Sew_Sumi - 06.02.2017

Quote:
Originally Posted by GoldenLion
Посмотреть сообщение
Client commands are client commands and server commands are server commands. It's not possible to detect that as far as I know.
What this guy says is correct. The command doesn't get sent to the server, it only turns up on the client.