Roleplay chat... i must help -
Lirbo - 17.04.2014
How to do roleplay chat?... This is shows the message only to the play who sended the message... i want it will send to everyone in this range... (sorry for bad english)
PHP код:
public OnPlayerText(playerid, text[])
{
format(String,sizeof(String),"%s says: %s",GetName(playerid),text);
GetPlayerPos(playerid,X,Y,Z);
if(IsPlayerInRangeOfPoint(playerid, 13.0, X, Y, Z)){
SendClientMessage(playerid,-1,String);}else{return 0;}
return 0;
}
Re: Roleplay chat... i must help -
DarkLored - 17.04.2014
here use this stock
pawn Код:
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;
}
pawn Код:
new targetid;
if(IsPlayerToPlayer(playerid, targetid, 10))
Re: Roleplay chat... i must help -
Lirbo - 17.04.2014
Quote:
Originally Posted by DarkLored
here use this stock
pawn Код:
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; }
pawn Код:
new targetid; if(IsPlayerToPlayer(playerid, targetid, 10))
|
umm it's showes the message only for me..
pawn Код:
public OnPlayerText(playerid, text[])
{
new targetid;
format(String,sizeof(String),"%s says: %s",GetName(playerid),text);
if(PlayerToPlayer(playerid,targetid,13)){
SendClientMessage(targetid,-1,String);}
return 0;
}
Re: Roleplay chat... i must help -
DarkLored - 17.04.2014
put the if statement above the format that should work
Re: Roleplay chat... i must help -
Lirbo - 17.04.2014
Quote:
Originally Posted by DarkLored
put the if statement above the format that should work
|
What do you mean bro? i putted the stock... it's not error... its just not shows the message to other people.. only for me
Re: Roleplay chat... i must help -
DarkLored - 18.04.2014
pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(PlayerToPlayer(playerid,i,13))
{
format(String,sizeof(String),"%s says: %s",GetName(playerid),text);
SendClientMessage(targetid,-1,String);
}
}
Sorry forgot that you need to use MAX_PLAYERS for this one
Re: Roleplay chat... i must help -
Lirbo - 18.04.2014
One error... sorry for that :P
pawn Код:
public OnPlayerText(playerid, text[])
{
new targetid
for(new i = 0; i < MAX_PLAYERS; i++){
if(PlayerToPlayer(playerid,i,13)){
format(String,sizeof(String),"%s says: %s",GetName(playerid),text);
SendClientMessage(targetid,-1,String);}}
return 0;
}
pawn Код:
error 001: expected token: ";", but found "for"
The problem's line:
pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
Re: Roleplay chat... i must help -
DarkLored - 18.04.2014
remove the targetid you don't need it i was mistaken
Re: Roleplay chat... i must help -
Lirbo - 18.04.2014
Quote:
Originally Posted by DarkLored
remove the targetid you don't need it i was mistaken
|
Thanks alot