It Online Show ID not Playername (ID) -
kbalor - 13.08.2012
So when I do /jailed it only shows (ID:0) not the whole name and id like this Playername (ID:2)
pawn Код:
dcmd_jailed(playerid,params[])
{
#pragma unused params
if(AccInfo[playerid][LoggedIn] == 1)
{
if(AccInfo[playerid][Level] >= 1)
{
new Count, str[512];
for(new i; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && AccInfo[i][Jailed])
{
format(str, sizeof(str), "%s (ID: %d)\n", i, PlayerName2(i));
Count++;
}
}
if(Count == 0) strcat(str, "No players are Jailed!\n");
return ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Jailed Players", str, "OK", "");
}
else return ErrorMessages(playerid, 1);
}
else return SendClientMessage(playerid, 0xFFFFFFFF,"{FF0000}ERROR: You must be logged in to use this commands");
}
Re: It Online Show ID not Playername (ID) -
ddnbb - 13.08.2012
Quote:
Originally Posted by kbalor
So when I do /jailed it only shows (ID:0) not the whole name and id like this Playername (ID:2)
pawn Код:
dcmd_jailed(playerid,params[]) { #pragma unused params if(AccInfo[playerid][LoggedIn] == 1) { if(AccInfo[playerid][Level] >= 1) { new Count, str[512]; for(new i; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i) && AccInfo[i][Jailed]) { format(str, sizeof(str), "%s (ID: %d)\n", i, PlayerName2(i)); Count++; } } if(Count == 0) strcat(str, "No players are Jailed!\n"); return ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Jailed Players", str, "OK", ""); } else return ErrorMessages(playerid, 1); } else return SendClientMessage(playerid, 0xFFFFFFFF,"{FF0000}ERROR: You must be logged in to use this commands"); }
|
pawn Код:
format(str, sizeof(str), "%s (ID: %d)\n", PlayerName2(i), i);
PS. string size 512? change it to like 64...
Re: It Online Show ID not Playername (ID) -
Jefff - 13.08.2012
pawn Код:
format(str, sizeof(str), "%s%s (ID: %d)\n",str,PlayerName2(i),i);
Re: It Online Show ID not Playername (ID) -
kbalor - 13.08.2012
Quote:
Originally Posted by ddnbb
pawn Код:
format(str, sizeof(str), "%s (ID: %d)\n", PlayerName2(i), i);
PS. string size 512? change it to like 64...
|
Thanks man its working now.
I also have same problem but this time the ID doesn't show
Код:
if(!strlen(params[strlen(tmp2)+1]))
format(string,sizeof(string),"%s has Frozen %s",adminname,playername);
else format(string,sizeof(string),"%s has Frozen %s | Reason: %s",adminname,playername,params[strlen(tmp)+1]);
I think the purpose of 512.. what if they are around 20 players in jailed? and their names are long.
Re: It Online Show ID not Playername (ID) -
kbalor - 13.08.2012
Quote:
Originally Posted by Jefff
pawn Код:
format(str, sizeof(str), "%s%s (ID: %d)\n",str,PlayerName2(i),i);
|
Both are working and same, but what is the difference??
Re: It Online Show ID not Playername (ID) -
Jefff - 13.08.2012
Code by ddnbb shows only one person, my all in jail
Re: It Online Show ID not Playername (ID) -
ddnbb - 13.08.2012
Quote:
Originally Posted by kbalor
Both are working and same, but what is the difference??
|
EDIT: NVM
Re: It Online Show ID not Playername (ID) -
kbalor - 13.08.2012
Thanks I give rep to you both
If you have time to fix this, it only show name not with the ID.
It should be something like this "Playername (ID:2)
Код:
if(!strlen(params[strlen(tmp2)+1]))
format(string,sizeof(string),"%s has Frozen %s",adminname,playername);
else format(string,sizeof(string),"%s has Frozen %s | Reason: %s",adminname,playername,params[strlen(tmp)+1]);
Re: It Online Show ID not Playername (ID) -
Kindred - 13.08.2012
pawn Код:
format(string,sizeof(string),"%s(%i) has Frozen %s",adminname,adminid, playername);
Do something like this. You obviously are a very new beginner.