/greet cmd
#1

Hello SA-MPer's! Today i need to ask something:

How To Create A /greet Command For A LAPD or FBI officer which send the target id message:

"Hello Sir/Ma'am! I Am Officer (username) Of (faction).
You Know Why You Are Pulled Over Today?"

And I Also Want Tat if the target id is not in range of the user then it will return an error!


My Variables:



LAPD Variable:

Код:
if(PlayerInfo[playerid][pMember] == 1
FBI Variable:
Код:
if(PlayerInfo[playerid][pMember] == 2
If You Need Any More Code Just Reply Here.

Regards,
TahaAsif12
Reply
#2

pawn Код:
//greet  cmd
{
new ID,MsgString[150];if(sscanf(params,"us[150]", String)) return SendClientMessage(playerid, -1, "Usage: /Greet [ID] [MESSAGE]");
new Float:Pos[3];GetPlayerPos(ID,Pos[0],Pos[2],Pos[3]);
if(!IsPlayerInRangeOfPoint(playerid, 10.0, Pos[0],Pos[2],Pos[3])) return SendClientMessage(playerid, -1, "Target Player is not near you!");
SendClientMessage(ID,-1,String);
}
Simple
Reply
#3

Quote:
Originally Posted by park4bmx
Посмотреть сообщение
pawn Код:
//greet  cmd
{
new ID,MsgString[150];if(sscanf(params,"us[150]", String)) return SendClientMessage(playerid, -1, "Usage: /Greet [ID] [MESSAGE]");
new Float:Pos[3];GetPlayerPos(ID,Pos[0],Pos[2],Pos[3]);
if(!IsPlayerInRangeOfPoint(playerid, 10.0, Pos[0],Pos[2],Pos[3])) return SendClientMessage(playerid, -1, "Target Player is not near you!");
SendClientMessage(ID,-1,String);
}
Simple
Hmm, thx. but i need a command which auto-sends the message to the target.
I will rep u if u can make me one
PS: i suck at pawno
Reply
#4

Here you go mate change the text to whatever you like and the [pmember], if you don't know how I'll do it for you.


Quote:

CMD:greet(playerid, params[])
{
if(IsACop(playerid))
{
new string[128], giveplayerid;
if(sscanf(params, "i", giveplayerid)) return Syntax(playerid,"greet", "[playerid]");

if(IsPlayerConnected(giveplayerid))
{
if(PlayerInfo[playerid][pMember] == 7)
{
format(string, sizeof(string), " You have greeted %s ", GetPlayerNameEx(giveplayerid));
SendClientMessageEx(playerid, COLOR_WHITE, string);
format(string, sizeof(string), " Hello, I'm Deputy %s from the Los Santos Sheriff's Department ", GetPlayerNameEx(playerid));
SendClientMessageEx(giveplayerid, COLOR_GRAD1, string);
SendClientMessageEx(giveplayerid, COLOR_GRAD1, "Do you know why I am stopping you today?");
}
if(PlayerInfo[playerid][pMember] == 1)
{
format(string, sizeof(string), " You have greeted %s ", GetPlayerNameEx(giveplayerid));
SendClientMessageEx(playerid, COLOR_WHITE, string);
format(string, sizeof(string), " Hello, I'm Officer %s from the Los Santos Police Department ", GetPlayerNameEx(playerid));
SendClientMessageEx(giveplayerid, COLOR_GRAD1, string);
SendClientMessageEx(giveplayerid, COLOR_GRAD1, "Do you know why I am stopping you today?");
}
}
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
}
return 1;
}

Reply
#5

pawn Код:
YCMD:greet(playerid, params[], help)
{
   #pragma unused help
   if(PlayerInfo[playerid][pMember] != 1 && PlayerInfo[playerid][pMember] != 2)
      return SendClientMessage(playerid, -1, "You are not L.A.P.D Officer or F.B.I Agent!");
   new giveplayer;
   if(sscanf(params, "u", giveplayer))
      return SendClientMessage(playerid, -1, "Usage: /greet [playerid/PartOfName]");
   new Float:pos[3];
   GetPlayerPos(giveplayer, pos[0], pos[1], pos[2]);
   if(!IsPlayerInRangeOfPoint(playerid, 5.0, pos[0], pos[1], pos[2]))
      return SendClientMessage(playerid, -1, "Error: You are too far from the player!");
   new pName[24];
   GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
   new string[128];
   if(PlayerInfo[playerid][pMember] == 1)
   {
      format(string, 128, "Hello Sir/Ma'am! I am Officer %s of Los Angeles Police Dept.", pName);
      SendClientMessage(giveplayer, -1, string);
   }
   if(PlayerInfo[playerid][pMember] == 2)
   {
      format(string, 128, "Hello Sir/Ma'am! I am Agent %s", pName);
      SendClientMessage(giveplayer, -1, string);
   }
   SendClientMessage(giveplayer, -1, "You know why you are pulled over today?");
   return 1;
}
Reply
#6

Haha, thx both u u. it helped me! +repped both of ya'!
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)