Help Please - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help Please (
/showthread.php?tid=339365)
Help Please -
ColdRain - 03.05.2012
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
Re: Help Please -
JaKe Elite - 03.05.2012
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
Re: Help Please -
ColdRain - 03.05.2012
im using Tmp as playername not ID
like when i do SendClientMessage(tmp,COLOR_RED,"Hey"); it doesnt work !
Re: Help Please -
Accord - 03.05.2012
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;
}
Re: Help Please -
ColdRain - 03.05.2012
thnx i hope i can give you 100 Milllion Rep
Re: Help Please -
ColdRain - 03.05.2012
but dude one more question what do i add
instead of playerid
in
SendClientMessage9 ?
Re: Help Please -
Accord - 03.05.2012
Just compare your variable like that:
Код:
playername = FindPlayer(playername);