Need Help With Player Name. - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Need Help With Player Name. (
/showthread.php?tid=228630)
Need Help With Player Name. -
Alex_Obando - 20.02.2011
Hello, Im alex, I need you guys to help me with the GetPlayerName (%s) I have this script that is a bot, So when I type /banbot it'll say [Name Of Admin (%s)] Has Banned Jeremy (Reason: Becoming noob)
Code:
Код:
if (strcmp(cmdtext, "/banbot", true) == 0)
{
if(IsPlayerAdmin(playerid))
{
SendClientMessage(playerid,0xff0000ff, "----------------------------------");
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Banning the bot simulation successful, If the bot still talking unloadhim with the rcon.");
SendClientMessageToAll(COLOR_RED,"Administrator has banned Jeremy (Reason: TEST)");
SendClientMessageToAll(COLOR_GREY, "Jeremy has left the server (Kicked).");
return 1;
}
else
{
SendClientMessage(playerid,COLOR_YELLOW,"You are not [AU] Member");
return 1;
}
}
return 0;
}
Re: Need Help With Player Name. -
Haydz - 20.02.2011
you can use this to get a players name easily
pawn Код:
stock GetName(playerid)
{
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
return pName;
}
also when you want to display somebodys name in a clientmessage you will need to format it
pawn Код:
new string[70];
format(string,sizeof(string),"%s has been kicked", GetName(playerid)); //GetName(playerid) will get the name of the player who used the commands, you will need to define something which gets the other users name.
SendClientMessageToAll(color,string);
Whenever you wish to get a players name you can use GetName(playerid); you can change playerid to something eles if you wish to get the name of another player.
Respuesta: Need Help With Player Name. -
Alex_Obando - 20.02.2011
Can you plese send me my code with this thing added?
Respuesta: Need Help With Player Name. -
Alex_Obando - 20.02.2011
Plese?