01.07.2016, 21:47
Alright so Im trying to make a simple system that will work like
@SomePlayerName Hey bro
and then it would display the GameText to the other player, now my problem is quite simple, it will constantly reproduce the "Player is not connected". Now I know that its because first character is @ inside the string so it will basically check
if(IsPlayerConnected(@)
or for example if u type in @Twinki it will check if @Twinki is connected, how to resolve this?
@SomePlayerName Hey bro
and then it would display the GameText to the other player, now my problem is quite simple, it will constantly reproduce the "Player is not connected". Now I know that its because first character is @ inside the string so it will basically check
if(IsPlayerConnected(@)
or for example if u type in @Twinki it will check if @Twinki is connected, how to resolve this?
PHP код:
public OnPlayerText(playerid, text[])
{
if(text[0] == '@') {
new otherplayer;
if(sscanf(text,"u",otherplayer)) return SendClientMessage(playerid,COLOR_RED,"Usage: @Player_Name [message]");
if(!IsPlayerConnected(otherplayer)) return SendClientMessage(playerid, COLOR_RED,"Invalid playerid / not connected");
new string[128];
format(string,sizeof(string),"%s mentioned you in the chat",GetName(playerid));
GameTextForPlayer(otherplayer,string,2000,4);
}
return 1;
}