SA-MP Forums Archive
How to make this Rcon Admin only - 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: How to make this Rcon Admin only (/showthread.php?tid=117717)



How to make this Rcon Admin only - JoeDaDude - 01.01.2010

With my /goto command ive made it so if you say the command and your not logged into rcon,
it says you are not an administrator, and if ur logged into rcon, the command works,
But because my /setcash is diffrent format im not so sure,
Heres my code? How do i make it, If you say /givecash it shows usage,
If you do /givecash [id] it again shows usage,
But if you do /givecash [id] [amount] It says, You are not an Administrator,
So what would i add onto this so it checks if player is logged into rcon,
And if he is, It lets him use the command,
But if hes not it says You are not an Administrator,

pawn Код:
dcmd_setcash(playerid, params[])
{
    new
        giveplayerid,
        amount;
    if (sscanf(params, "ud", giveplayerid, amount)) SendClientMessage(playerid, 0xFF0000AA, "Usage: /givecash [playerid/partname] [amount]");
    else if (giveplayerid == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFF0000AA, "Player not found");
    else
    {
      ResetPlayerMoney(playerid);
        GivePlayerMoney(giveplayerid, amount);
        new name[MAX_PLAYER_NAME], string[48];
    GetPlayerName(playerid, name, sizeof(name));
    format(string, sizeof(string), "Admin %s has set your cash to %d", name, amount);
    SendClientMessage(giveplayerid, 0xFFFF00AA, string);
    }
    return 1;
}



Re: How to make this Rcon Admin only - SpiderPork - 01.01.2010

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


Re: How to make this Rcon Admin only - JoeDaDude - 01.01.2010

where abouts on my code wud i put tht


Re: How to make this Rcon Admin only - SpiderPork - 01.01.2010

After dcmd_setcash(playerid, params[])...


Re: How to make this Rcon Admin only - Correlli - 01.01.2010

pawn Код:
dcmd_setcash(playerid, params[])
{
  if(IsPlayerAdmin(playerid))
  {
    // player is logged in as RCON-admin.
  }
  else
  {
    // player isn't logged in as RCON-admin.
  }
  return 1;
}



Re: How to make this Rcon Admin only - _Vortex - 01.01.2010

Код:
dcmd_setcash(playerid, params[])
{
	new
		giveplayerid,
		amount;
  if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,color,"You must be admin to use this command");
	if (sscanf(params, "ud", giveplayerid, amount)) SendClientMessage(playerid, 0xFF0000AA, "Usage: /givecash [playerid/partname] [amount]");
	else if (giveplayerid == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFF0000AA, "Player not found");
	else
	{
	  ResetPlayerMoney(playerid);
		GivePlayerMoney(giveplayerid, amount);
		new name[MAX_PLAYER_NAME], string[48];
  	GetPlayerName(playerid, name, sizeof(name));
  	format(string, sizeof(string), "Admin %s has set your cash to %d", name, amount);
  	SendClientMessage(giveplayerid, 0xFFFF00AA, string);
	}
	return 1;
}
Is much less work..


Re: How to make this Rcon Admin only - RyDeR` - 01.01.2010

What Don answered was right.


Re: How to make this Rcon Admin only - JoeDaDude - 01.01.2010

Im using Don's as a template for future cmds and this, ect
Only i change IsPlayerAdmin to my new system i using