Making a command that displays a /me action.
#1

Okay, I have searched for this, But no luck.. I cannot find it..
So what I want is so if I type in a command, In my situation it is /gateo or /gatec it displays a little /me action to nearby players.

Example:
I drive up to the gate and type /gateo and it starts to open and on the text it says
*Ryan_Fay uses a small remote to open the gates.
Here is my script


command(gateo, playerid, params[])
{
if(Groups[Player[playerid][Group]][CommandTypes] == 1 || Groups[Player[playerid][Group]][CommandTypes] == 4)
{
if(PlayerToPoint(15.0, playerid,-210.80146790, 999.80938721, 20.4211692)
{
MoveDynamicObject(lspdgate, -218.80146790, 1007.80938721, 0.42116928, 1);
return 1;
}
}
}

command(gatec, playerid, params[])
{
if(Groups[Player[playerid][Group]][CommandTypes] == 1 || Groups[Player[playerid][Group]][CommandTypes] == 4)
{
if(PlayerToPoint(15.0, playerid,-210.80146790, 999.80938721, 20.4211692)
{
MoveDynamicObject(lspdgate, -218.80146790, 1007.80938721, 20.42116928, 1);
return 1;
}
}
}
Reply
#2

Код:
	if(!strcmp(cmdtext, "/me", true, 3)) //action use /me [action]
  	{
		if(!cmdtext[3])return SendClientMessage(playerid, 0xFF0000FF, "Use: /me [action]");
		new str[128];
		GetPlayerName(playerid, str, sizeof(str));
		format(str, sizeof(str), "%s %s", str, cmdtext[4]);
		SendClientMessageToAll(0xFFFF00AA, str);
		return 1;
	}
not tested

is this what u want ?
Reply
#3

This is not what I want.. Please read my post.. not just the topic
Reply
#4

make a loop to get the players near the gate and then display a formatted string to them if they are
Reply
#5

And how would I do this? I am not the best scripter ever.. sorry
Reply
#6

try this
Код:

command(gateo, playerid, params[])
{
if(Groups[Player[playerid][Group]][CommandTypes] == 1 || Groups[Player[playerid][Group]][CommandTypes] == 4)
{
if(PlayerToPoint(15.0, playerid,-210.80146790, 999.80938721, 20.4211692)
{
MoveDynamicObject(lspdgate, -218.80146790, 1007.80938721, 0.42116928, 1);

for (new i = 0; i != MAX_PLAYERS; ++i)
	{
	    if (IsPlayerConnected(i))
	    {
		    if(PlayerToPoint(50.0, playerid,-210.80146790, 999.80938721, 20.4211692)) //Set Distance for Messege
			{
			    new name[MAX_PLAYER_NAME], string[100];
			    GetPlayerName(playerid, name, sizeof(name));
			    format(string, sizeof(string), "*%s uses a small remote to open the gates.",name);
			    SendClientMessage(i, COLOR_GREEN, string);
		    }
		}
	}

return 1;
}
}
}

command(gatec, playerid, params[])
{
if(Groups[Player[playerid][Group]][CommandTypes] == 1 || Groups[Player[playerid][Group]][CommandTypes] == 4)
{
if(PlayerToPoint(15.0, playerid,-210.80146790, 999.80938721, 20.4211692)
{
MoveDynamicObject(lspdgate, -218.80146790, 1007.80938721, 20.42116928, 1);
for (new i = 0; i != MAX_PLAYERS; ++i)
	{
	    if (IsPlayerConnected(i))
	    {
		    if(PlayerToPoint(50.0, playerid,-210.80146790, 999.80938721, 20.4211692)) //Set Distance for Messege
			{
			    new name[MAX_PLAYER_NAME], string[100];
			    GetPlayerName(playerid, name, sizeof(name));
			    format(string, sizeof(string), "*%s uses a small remote to open the gates.",name);
			    SendClientMessage(i, COLOR_GREEN, string);
		    }
		}
	}
return 1;
}
}
}
make sure to change the color and range to what you want
Reply
#7

Thanks, Going to go try that now..
Reply
#8

Код:
C:\Users\Brandona_2\Desktop\rxrp\gamemodes\VortexRP.pwn(861) : warning 217: loose indentation
C:\Users\Brandona_2\Desktop\rxrp\gamemodes\VortexRP.pwn(900) : warning 217: loose indentation
C:\Users\Brandona_2\Desktop\rxrp\gamemodes\VortexRP.pwn(14719) : warning 202: number of arguments does not match definition
C:\Users\Brandona_2\Desktop\rxrp\gamemodes\VortexRP.pwn(18826) : error 029: invalid expression, assumed zero
C:\Users\Brandona_2\Desktop\rxrp\gamemodes\VortexRP.pwn(18834) : error 029: invalid expression, assumed zero
C:\Users\Brandona_2\Desktop\rxrp\gamemodes\VortexRP.pwn(18846) : warning 209: function "cmd_gateo" should return a value
C:\Users\Brandona_2\Desktop\rxrp\gamemodes\VortexRP.pwn(18853) : error 029: invalid expression, assumed zero
C:\Users\Brandona_2\Desktop\rxrp\gamemodes\VortexRP.pwn(18860) : error 029: invalid expression, assumed zero
C:\Users\Brandona_2\Desktop\rxrp\gamemodes\VortexRP.pwn(18871) : warning 209: function "cmd_gatec" should return a value
C:\Users\Brandona_2\Desktop\rxrp\gamemodes\VortexRP.pwn(29442) : warning 203: symbol is never used: "CGate1"
C:\Users\Brandona_2\Desktop\rxrp\gamemodes\VortexRP.pwn(29442) : warning 203: symbol is never used: "CGate2"
C:\Users\Brandona_2\Desktop\rxrp\gamemodes\VortexRP.pwn(29442) : warning 203: symbol is never used: "CGateOpen"
C:\Users\Brandona_2\Desktop\rxrp\gamemodes\VortexRP.pwn(2927) : warning 204: symbol is assigned a value that is never used: "GateOpen"
C:\Users\Brandona_2\Desktop\rxrp\gamemodes\VortexRP.pwn(1632) : warning 204: symbol is assigned a value that is never used: "ImpoundOpen"
C:\Users\Brandona_2\Desktop\rxrp\gamemodes\VortexRP.pwn(1632 -- 29442) : warning 203: symbol is never used: "MarketGate"
C:\Users\Brandona_2\Desktop\rxrp\gamemodes\VortexRP.pwn(1632 -- 29442) : warning 203: symbol is never used: "MarketGateOpen"
C:\Users\Brandona_2\Desktop\rxrp\gamemodes\VortexRP.pwn(2676) : warning 204: symbol is assigned a value that is never used: "PrisonGateOpen"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Ignore the warnings..
Reply
#9

Can you tell me what the error lines are? Make sure that you either #define the color or change it to a already defined one btw.
Reply
#10

Here is the part that has the errors

Код:
command(gateo, playerid, params[])
{
if(Groups[Player[playerid][Group]][CommandTypes] == 1 || Groups[Player[playerid][Group]][CommandTypes] == 4)
{
if(PlayerToPoint(15.0, playerid,-210.80146790, 999.80938721, 20.4211692)
{
MoveDynamicObject(lspdgate, -218.80146790, 1007.80938721, 0.42116928, 1);

for (new i = 0; i != MAX_PLAYERS; ++i)
	{
	    if (IsPlayerConnected(i))
	    {
		    if(PlayerToPoint(50.0, playerid,-210.80146790, 999.80938721, 20.4211692) //Set Distance for Messege
			{
			    new name[MAX_PLAYER_NAME], string[100];
			    GetPlayerName(playerid, name, sizeof(name));
			    format(string, sizeof(string), "*%s uses a small remote to open the gates.",name);
			    SendClientMessage(i, PURPLE, string);
		    }
		}
	}

return 1;
}
}
}

command(gatec, playerid, params[])
{
if(Groups[Player[playerid][Group]][CommandTypes] == 1 || Groups[Player[playerid][Group]][CommandTypes] == 4)
{
if(PlayerToPoint(15.0, playerid,-210.80146790, 999.80938721, 20.4211692)
{
MoveDynamicObject(lspdgate, -218.80146790, 1007.80938721, 20.42116928, 1);
for (new i = 0; i != MAX_PLAYERS; ++i)
	{
	    if (IsPlayerConnected(i))
	    {
		    if(PlayerToPoint(50.0, playerid,-210.80146790, 999.80938721, 20.4211692) //Set Distance for Messege
			{
			    new name[MAX_PLAYER_NAME], string[100];
			    GetPlayerName(playerid, name, sizeof(name));
			    format(string, sizeof(string), "*%s uses a small remote to close the gates.",name);
			    SendClientMessage(i, PURPLE, string);
		    }
		}
	}
return 1;
}
}
}
Here is my color codes
Код:
#define GREEN 			0x21DD00FF
#define RED 			0xE60000FF
#define YELLOW 			0xFFFF00FF
#define ORANGE 			0xF97804FF
#define LIGHTRED 		0xFF8080FF
#define NICESKY 		0x00C2ECFF
#define PURPLE 			0xB360FDFF
#define DEPARTMENT_CHAT 0xBDF38BFF
#define VIP_CHAT        0xE1FCFFFF
#define PLAYER_COLOR 	0xFFFFFFFF
#define BLUE 			0x1229FAFF
#define DBLUE           0x2641FEAA
#define GROUP_CHAT      0xC0FAFAFF
#define LIGHTGREEN 		0x38FF06FF
#define RADIO_CHAT 		0xBCC1F3FF
#define DARKPINK 		0xE100E1FF
#define PLAYERCOM       0xD5EAFFFF
#define DARKGREEN 		0x008040FF
#define ANNOUNCEMENT 	0xa9c4e4ff
#define GREY 			0xCECECEFF
#define PINK 			0xD52DFFFF
#define DARKGREY    	0x626262FF
#define OOC_CHAT        0x99FFFFAA
#define NEWBIE_CHAT     0x21DD00FF
#define AQUAGREEN   	0x03D687FF
//#define ADMINBLUE 		0x99FFFFAA
#define ADMINORANGE 	0xF6970CAA
#define WHITE 			0xFFFFFFFF
#define BLACK           0x000000FF
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)