Why wont this work? - 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: Why wont this work? (
/showthread.php?tid=244226)
Why wont this work? -
[MWR]Blood - 26.03.2011
If someone does /admins it only shows 1 admin even if there are more...
pawn Код:
if(strcmp(cmdtext,"/admins",true) == 0)
{
new string[200],string2[50],oadmins = 0;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(pinfo2[i][pAdminLevel] >= 1)
{
format(string,sizeof(string),""lgreen"%s\n",GetPName(i));
oadmins++;
}
}
format(string2,sizeof(string2),"Online admins: %i",oadmins);
ShowPlayerDialog(playerid,2351,0,string2,string,"Ok","Close");
return 1;
}
Thanks.
Re: Why wont this work? -
Zh3r0 - 26.03.2011
You need to reformat the string in the same format!
pawn Код:
format(string,sizeof(string),"%s"lgreen"%s \n",string, GetPName(i));
My version of yours;
pawn Код:
if ( !strcmp( cmdtext, "/admins" ))
{
new
Str[512],
Str2[30]
oadmins = 0;
for ( new i = 0; i < MAX_PLAYERS; i++ )
{
if ( pinfo2[ i ][ pAdminLevel ] > 0 )
{
format( Str, sizeof ( Str ), "%s"lgreen"%s\n",Str, GetPName( i ) );
oadmins++;
}
}
format( Str2, sizeof( Str2 ), "Online admins: %i", oadmins );
ShowPlayerDialog( playerid, 2351, 0, Str2, Str, "Close", "" );
return 1;
}