PDA

View Full Version : Command /mask


RenSoprano
17/03/2012, 11:58 AM
DELETED

[ABK]Antonio
17/03/2012, 12:07 PM
Instead of setting a name, why not just do this...


new bool:Masked[MAX_PLAYERS] = false;

public OnPlayerText(playerid, text[])
{
if(Masked[playerid])
{
new string[128];
format(string, sizeof(string), "Stranger says, \"%s\"", text);
SendClientMessageToAll(pick_a_color, string);
return 0;
}
return 1;
}

RenSoprano
17/03/2012, 12:24 PM
Thanks but I dont want to send message to all and i try to SendClientMessage and take error

public OnPlayerText(playerid, text[])
{
if(Masked[playerid])
{
new string[128];
format(string, sizeof(string), "Stranger says, \"%s\"", text);
SendClientMessage(playerid, string); // HERE IS ERROR
return 0;
}
return 1;
}

and here is error

C:\Users\home\Desktop\GFHF\gamemodes\rp1.pwn(232) : error 035: argument type mismatch (argument 2)

emokidx
17/03/2012, 12:26 PM
SendClientMessage(playerid, color, text);
it has got three arguments

SendClientMessage(playerid, -1, string);
replace -1 with your color

RenSoprano
17/03/2012, 12:27 PM
SendClientMessage(playerid, color, text);
it has got three arguments

SendClientMessage(playerid, -1, string);
replace -1 with your color

Thanks

[ABK]Antonio
17/03/2012, 12:31 PM
SendClientMessage(playerid, color, text);
it has got three arguments

SendClientMessage(playerid, -1, string);
replace -1 with your color

lol my bad, have other things on my mind :P

EDIT: oh no, i was correct..Don't use sendclientmessage and if you're using a radius message system make sure to use that

ReneG
17/03/2012, 12:33 PM
Umm, all the above code will only send whoever typed it the message, not to every one who is near you.

Add this anywhere outside of a callback in your script.
stock ProxDetector(Float:radi, playerid, string[],color)
{
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
foreach(Player,i)
{
if(!IsPlayerConnected(i))continue;
if(IsPlayerInRangeOfPoint(i,radi,x,y,z)) SendClientMessage(i,color,string);
}
}
and use this for your OnPlayerText
public OnPlayerText(playerid, text[])
{
if(Masked[playerid] == 1)
{
new string[128];
format(string, sizeof(string), "Stranger says: %s", text);
ProxDetector(30,playerid,string,-1); // Sends the Stranger says message to anyone who is 30 gta units close to the player
return 1;
}
return 0;
}