Help: Command to make Player say certain thing -
jakejohnsonusa - 05.11.2012
What I would like is a command (/greet) that checks if a person IsACop (defined already in my GM) and if they are it makes them say "Hello, I'm (officer name/persons name that used /greet) with the Los Santos Police Department. Do you know why I stopped you today?"
Can someone please explain how to do this? I am a begginer scripter, so help would be great!
Please & Thanks: jakejohnsonusa
Re: Help: Command to make Player say certain thing -
ThePhenix - 05.11.2012
PHP Code:
CMD:greet(playerid, params[])
{
new MSG[250];
new Name[MAX_PLAYER_NAME];
GetPlayerName(playerid,Name,sizeof(Name));
if(PlayerInfo[playerid][pCop] == true)
{
format(MSG,sizeof(MSG),"Hello, I'm %s [Police Officer] with the Los Santos Police Department. Do you know why I stopped you today?", Name);
SendClientMessageToAll(GREEN,MSG);
return 1;
}
Re: Help: Command to make Player say certain thing -
jakejohnsonusa - 05.11.2012
I see SendClientMessageToAll(GREEN,MSG); ... meaning it's not normal talking, I would like to know how to send the msg as normal talking. It will be for my RP server when an officer does a traffic stop...
Thanks for your help though, +1Rep
Please help me do this: jakejohnsonusa
Re: Help: Command to make Player say certain thing -
cosbraa - 05.11.2012
Why don't you let the cop say whatever he wants. I don't see any use in the cmd.
Re: Help: Command to make Player say certain thing -
jakejohnsonusa - 05.11.2012
The. command is a special cmd they can use, but I just really want to learn how to do this. Anyone that can help, please?
-jakejohnsonusa
Re: Help: Command to make Player say certain thing -
ThePhenix - 05.11.2012
Quote:
Originally Posted by jakejohnsonusa
I see SendClientMessageToAll(GREEN,MSG); ... meaning it's not normal talking, I would like to know how to send the msg as normal talking. It will be for my RP server when an officer does a traffic stop...
Thanks for your help though, +1Rep
Please help me do this: jakejohnsonusa
|
What do you mean??
So the message will be sent only for the players that are near the police officer?
Re: Help: Command to make Player say certain thing -
jakejohnsonusa - 05.11.2012
Yea basically. Like /greet would be the same as pressing F6 and typing it...
Re: Help: Command to make Player say certain thing -
ThePhenix - 05.11.2012
Not tested:
PHP Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
new MSG[250];
new Name[MAX_PLAYER_NAME];
GetPlayerName(playerid,Name,sizeof(Name));
if (strcmp("/greet", cmdtext, true, 10) == 0)
{
if(PlayerInfo[playerid][pCop] == 1){
if(PlayerToPlayer(playerid,5, 10.0)){
format(MSG,sizeof(MSG),"Hello, I'm %s [Police Officer] with the Los Santos Police Department. Do you know why I stopped you today?", Name);
SendClientMessage(playerid, COLOR_WHITE, MSG);{
return 1;
}
return 0;
}
stock PlayerToPlayer(playerid, targetid, Float:distance)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid,x,y,z);
if(IsPlayerInRangeOfPoint(targetid,distance,x,y,z))
{
return true;
}
return false;
}
Re: Help: Command to make Player say certain thing -
jakejohnsonusa - 05.11.2012
Thanks! I will test add and test it soon! Thanks!