Help Please
#1

Hey Guys i just create command /warn (playername)

now when i type player name everything its work good nice job but what is the problem

i want to send text message to the playername i type so like if he was connected in

he get Message text
Reply
#2

pawn Код:
new str[120], targetname[MAX_PLAYER_NAME];
GetPlayerName(playerid, targetname, MAX_PLAYER_NAME);
format(str, 120, "You are warned by Administrator %s(%d) | Maxium Warn: %d/%d", adminname, playerid, PlayerInfo[playerid][pWarn], MAX_WARNINGS);
SendClientMessage(targetid, -1, string); //-1 is color white change it to your color define
as you can see i didn't define adminname/playerinfo - pwarn/max_warnings/targetid.

Replace the following

adminname/playerinfo - pwarn/max_warnings/targetid

with your own ones
Reply
#3

im using Tmp as playername not ID

like when i do SendClientMessage(tmp,COLOR_RED,"Hey"); it doesnt work !
Reply
#4

I've created some function for you:
Код:
stock FindPlayer(const name[])
{
	new pt[MAX_PLAYER_NAME], Names[MAX_PLAYER_NAME];
	for(new i = 0,j = GetMaxPlayers(); i < j; i++)
	{
	    if(!IsPlayerConnected(i)) continue;
     	format(pt,256,"%i",i);
                GetPlayerName(playerid,Names,MAX_PLAYER_NAME);
		if(strfind(Names,name,true) != -1) return pt;
	}
	format(pt,256,"-1");
	return pt;
}
Reply
#5

thnx i hope i can give you 100 Milllion Rep
Reply
#6

but dude one more question what do i add
instead of playerid

in

SendClientMessage9 ?
Reply
#7

Just compare your variable like that:
Код:
playername = FindPlayer(playername);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)