Setting up commands for admins
#1

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
Reply
#2

https://sampwiki.blast.hk/wiki/Dcmd
Reply
#3

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;
	}
Reply
#4

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"
Reply
#5

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

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

dcmd FTW!
Reply
#8

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

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.

Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)