Roleplay chat... i must help
#1

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(playeridtext[])
{
    
format(String,sizeof(String),"%s says: %s",GetName(playerid),text);
    
GetPlayerPos(playerid,X,Y,Z);
    if(
IsPlayerInRangeOfPoint(playerid13.0XYZ)){
    
SendClientMessage(playerid,-1,String);}else{return 0;}
    return 
0;

Reply
#2

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))
Reply
#3

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;
}
Reply
#4

put the if statement above the format that should work
Reply
#5

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
Reply
#6

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
Reply
#7

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++)
Reply
#8

remove the targetid you don't need it i was mistaken
Reply
#9

Quote:
Originally Posted by DarkLored
Посмотреть сообщение
remove the targetid you don't need it i was mistaken
Thanks alot
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)