WTF is wrong with this cmd :S?
#1

hey, I made this cmd and it doesn't work i can't figure out why

Код:
public OnRconCommand(cmd[])
{
	if (strcmp(cmd, "/ecash", true)==0)
	{
  printf("You just gave a player 10 thousand dollars!",cmd);
  SetPlayerMoney(playerid, 10000);
  return 1;
}
	return 0;
}
Reply
#2

There is no playerid which you could give money to. Use sscanf to split params and get possible player you are looking for.
Reply
#3

Код:
public OnRconCommand(cmd[])
{
  if (strcmp(cmd, "/ecash", true)==0)
   { 
    SendClientMessage(playerid, COLOR_GREEN, "You just gave a player 10 thousand dollars!");
    SetPlayerMoney(playerid, 10000);
  return 1;
}

Note: you can change the color.

Reply
#4

As far as I know, OnRconCommand has no playerid attribute.

Also, RCON commands do not work like /command. Unless you intend to access it like /rcon /command, but that's stupid.
Reply
#5

From wiki:

Quote:

This callback is called when a player types things into the RCON console. This only works in filterscripts, however.

And I still don't think you will be able to make a new RCON command ^^.

Use OnPlayerCommandText, with IsPlayerAdmin if you want him to be RCON
Reply
#6

You can use IsPlayerAdmin

Use it like you would on a normal command but IsPlayerAdmin checks if you are an RCON admin.

https://sampwiki.blast.hk/wiki/IsPlayerAdmin

I have tested with a command in my script and it does work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)