[Pawn] help with this pls - Printable Version + open.mp forum (https://forum.open.mp) -- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3) --- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10) --- Thread: [Pawn] help with this pls (/showthread.php?tid=1705) |
help with this pls - Nicolas_Belic - 2021-02-23 Code: CMD:id(playerid, params[]) { my idea is to make a command so that when you put / id and the name of the player you can receive the ID of the player RE: help with this pls - Nicolas_Belic - 2021-02-23 i get the playerid, but i don't have the player name, i have my playername RE: help with this pls - destiezk - 2021-02-24 as far as I know sscanf parameter ?u? stands for ID and Name as well. if you use %d with ?u? that should be working fine. RE: help with this pls - destiezk - 2021-02-24 Code: CMD:id(playerid, params[]) RE: help with this pls - ImOver - 2021-02-25 You are getting your nickname, Not the Player's nickname So you can simply do Code: GetPlayerName(params[0], name, sizeof(name)); and that should work I believe. RE: help with this pls - Kwarde - 2021-02-25 (2021-02-24, 01:19 AM)destiezk Wrote:Except for the fact that "MAX_PLAYER_NAME 1" should be just "MAX_PLAYER_NAME" (reaching length MAX_PLAYER_NAME (24) is only possible with SetPlayerName()) and that 256 cells is useless for an array only used in SendClientMessage() (max. output is 144 characters anyway), this is the code you're looking for (ignoring the indentation). You need a variable to store the found (or non found) playerid in. You can't do that in params. RE: help with this pls - Freaksken - 2021-02-26 (2021-02-25, 09:26 PM)Kwarde Wrote: Except for the fact that "MAX_PLAYER_NAME 1" should be just "MAX_PLAYER_NAME" (reaching length MAX_PLAYER_NAME (24) is only possible with SetPlayerName()) You need the for the null terminator. See?this fiddle for a visualisation with and without the . RE: help with this pls - destiezk - 2021-02-26 (2021-02-25, 09:26 PM)Kwarde Wrote:(2021-02-24, 01:19 AM)destiezk Wrote: What you're saying is incorrect, you need 1 for the null terminator. The guy above me linked you an example. |