SA-MP Forums Archive
Setting up commands for admins - 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: Setting up commands for admins (/showthread.php?tid=137401)



Setting up commands for admins - Assyria - 28.03.2010

Hey!


Код:
if (strcmp("/Fire", cmdtext, true, 10) == 0)
	{
	gTeam[playerid] = TEAM_FIRE;
	SetPlayerSkin(playerid, 135);
	SetPlayerColor(playerid, 0xFFFFFFAA);
	SendClientMessage(playerid,0xAA0000AA,"You got fired!");
	return 1;
	}
So, what I want to make for that is this:

Make so its available to admins to do /Fire (ID/Playername)
Then the player what gets that gets effected with those lines (SetPlayerSkin, SetPlayerColor, gTeam...)

So how to make that?

Regards,
Assyria


Re: Setting up commands for admins - [HiC]TheKiller - 28.03.2010

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


Re: Setting up commands for admins - aircombat - 28.03.2010

ok i created the command , good luck

Код:
if(strcmp(cmdtext,"/fire", true) == 0) {
		new tmp[256];
		new idx;
		new giveplayerid;
		new string[128];
		if(IsPlayerAdmin(playerid))
		{
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid,0xF97804FF, "USAGE: /fire [name/id]");
				return 1;
			}

			giveplayerid = strval(tmp);
			if(giveplayerid != INVALID_PLAYER_ID)
			{
			gTeam[giveplayerid] = TEAM_FIRE;
			SetPlayerSkin(giveplayerid, 135);
			SetPlayerColor(giveplayerid, 0xFFFFFFAA);
			SendClientMessage(giveplayerid,0xAA0000AA,"You got fired!");
			}
			else if(giveplayerid == INVALID_PLAYER_ID)
			{
				format(string, sizeof(string), "%s is not an active player.", giveplayerid);
				SendClientMessage(playerid, 0xFF0000AA, string);
			}
		}
		else SendClientMessage(playerid, 0xFF0000AA, "You cannot use this command!");
		return 1;
	}



Re: Setting up commands for admins - ¤Adas¤ - 28.03.2010

Quote:
Originally Posted by [AC
Etch ]
ok i created the command , good luck

Код:
if(strcmp(cmdtext,"/fire", true) == 0) {
		new tmp[256];
		new idx;
		new giveplayerid;
		new string[128];
		if(IsPlayerAdmin(playerid))
		{
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid,0xF97804FF, "USAGE: /fire [name/id]");
				return 1;
			}

			giveplayerid = strval(tmp);
			if(giveplayerid != INVALID_PLAYER_ID)
			{
			gTeam[giveplayerid] = TEAM_FIRE;
			SetPlayerSkin(giveplayerid, 135);
			SetPlayerColor(giveplayerid, 0xFFFFFFAA);
			SendClientMessage(giveplayerid,0xAA0000AA,"You got fired!");
			}
			else if(giveplayerid == INVALID_PLAYER_ID)
			{
				format(string, sizeof(string), "%s is not an active player.", giveplayerid);
				SendClientMessage(playerid, 0xFF0000AA, string);
			}
		}
		else SendClientMessage(playerid, 0xFF0000AA, "You cannot use this command!");
		return 1;
	}
It must be: "%i is not active player"


Re: Setting up commands for admins - Joe_ - 28.03.2010

Use DCMD and SSCANF, it's much faster and works more efficiently, strtok is just sickly.



Re: Setting up commands for admins - aircombat - 28.03.2010

joe_ i know that but he asked to make it in strtok and that's what i made


Re: Setting up commands for admins - RyDeR` - 28.03.2010

dcmd FTW!


Re: Setting up commands for admins - [NL]Bank - 28.03.2010

Quote:
Originally Posted by » RyDeR «
dcmd FTW!
zcmd FTW


Re: Setting up commands for admins - Joe_ - 28.03.2010

Quote:
Originally Posted by BlackBank3
Quote:
Originally Posted by » RyDeR «
dcmd FTW!
zcmd FTW
You just kidnapped the moment, raped it, brutely murdered it, failed to give it a proper burial, and had a crap on it.




Re: Setting up commands for admins - sammypiv - 29.03.2010

Quote:
Originally Posted by Joe_
Quote:
Originally Posted by BlackBank3
Quote:
Originally Posted by » RyDeR «
dcmd FTW!
zcmd FTW
You just kidnapped the moment, raped it, brutely murdered it, failed to give it a proper burial, and had a crap on it.

Lol.....
Nice one.