hlmod.hu
https://hlmod.hu/

VIP plugin problema
https://hlmod.hu/viewtopic.php?f=9&t=31554
Oldal: 1 / 1

Szerző:  kecskebeka12 [ 2024.02.21. 08:29 ]
Hozzászólás témája:  VIP plugin problema

Sziasztok Valaki nem tudna segiteni hogy hogyan oldjam meg ezt a problemat?

amikor be irom,hogy /vips ezt a hibat adja elo

L 02/21/2024 - 08:21:40: String formatted incorrectly - parameter 4 (total 3)
L 02/21/2024 - 08:21:40: [AMXX] Displaying debug trace (plugin "ElemenTVIP.amxx", version "2.0")
L 02/21/2024 - 08:21:40: [AMXX] Run time error 25: parameter error
L 02/21/2024 - 08:21:40: [AMXX] [0] phpUWC9pN.sma::ShowVIPs (line 864)

public ShowVIPs( id )
{
if(!is_user_connected( id ) )
return PLUGIN_HANDLED;

new vip_name[33];
new message[190];
new contor, len;

if( is_user_vip( id ) )
{
get_user_name( id, vip_name[ contor++ ], charsmax( vip_name ) );
}

len = format( message, charsmax( message ), "!g%s !yVIP's Online!team: " ); ezt a sort adja problemanak
if( contor > 0 )
{
for( new i = 0 ; i < contor ; i++)
{
len += format( message[ len ], charsmax( message ) - len, "!y%s%s ", vip_name[ i ], i < ( contor - 1 ) ? ", " : "");
if(len > 96 )
{
color_chat( id, message );
len = format( message, charsmax( message ), "%s ");
}
}
color_chat( id, message);
}
else
{
len += format( message[ len ], charsmax( message ) - len, "Nincs VIP online.");
color_chat( id, message );
}
return PLUGIN_CONTINUE;
}

Csatolmányok:
ElemenTVIP.sma [24.66 KiB]
Letöltve 12 alkalommal.

Szerző:  The Peace [ 2024.02.22. 13:37 ]
Hozzászólás témája:  Re: VIP plugin problema

Rég foglalkoztam pawn-al de teszteld:


  1. public ShowVIPs(id)
  2. {
  3.     if (!is_user_connected(id))
  4.         return PLUGIN_HANDLED;
  5.  
  6.     new vip_names[256];
  7.     new message[256];
  8.     new contor;
  9.  
  10.     for (new i = 1; i <= MaxClients; i++)
  11.     {
  12.         if (is_user_vip(i))
  13.         {
  14.             get_user_name(i, vip_names, sizeof(vip_names));
  15.             format(message, charsmax(message), "%s%s%s", message, contor++ > 0 ? ", " : "", vip_names);
  16.         }
  17.     }
  18.  
  19.     if (contor > 0)
  20.     {
  21.         format(message, charsmax(message), "!g%s !yVIP's Online!team: %s", message);
  22.         color_chat(id, message);
  23.     }
  24.     else
  25.     {
  26.         color_chat(id, "Nincs VIP online.");
  27.     }
  28.  
  29.     return PLUGIN_CONTINUE;
  30. }


Javitottam a`get_user_name` hívását és a `format` függvény használatát is.

Szerző:  kecskebeka12 [ 2024.02.24. 19:51 ]
Hozzászólás témája:  Re: VIP plugin problema

Udv. Sajnos nem mukodik,mostmar leforditja de csak engem mutat az online VIP-ek kozott ha be irom a /vips parancsot

Szerző:  DexoN [ 2024.02.25. 14:47 ]
Hozzászólás témája:  Re: VIP plugin problema

Logikailag ez a rész teljesen hülyeség, mivel sosem lesz több mint 1 a "contor" változód, így mindig csak 1 játékost fog kiírni.
  1. public ShowVIPs( id )
  2. {
  3.     if(!is_user_connected( id ) )
  4.         return PLUGIN_HANDLED;
  5.        
  6.     new vip_name[33];
  7.     new message[190];
  8.     new contor, len;
  9.  
  10.     if( is_user_vip( id ) )
  11.     {
  12.         get_user_name( id, vip_name[ contor++ ], charsmax( vip_name ) );
  13.     }
  14.  
  15.     len = format( message, charsmax( message ), "!g%s !yVIP's Online!team: " );
  16.     if( contor > 0 )
  17.     {
  18.         for( new i = 0 ; i < contor ; i++)
  19.         {
  20.             len += format( message[ len ], charsmax( message ) - len, "!y%s%s ", vip_name[ i ], i < ( contor - 1 ) ? ", " : "");
  21.             if(len > 96 )
  22.             {
  23.                 color_chat( id, message );
  24.                 len = format( message, charsmax( message ), "%s ");
  25.             }
  26.         }
  27.         color_chat( id, message);
  28.     }
  29.     else
  30.     {
  31.         len += format( message[ len ], charsmax( message ) - len, "Nincs VIP online.");
  32.         color_chat( id, message );
  33.     }
  34.     return PLUGIN_CONTINUE;
  35. }


írd át erre:

  1. public ShowVIPs( id )
  2. {
  3.     if(!is_user_connected( id ) )
  4.         return PLUGIN_HANDLED;
  5.        
  6.     new vip_name[33];
  7.     new message[190];
  8.     new contor, len;
  9.  
  10.     if( is_user_vip( id ) )
  11.     {
  12.         get_user_name( id, vip_name[ contor++ ], charsmax( vip_name ) );
  13.     }
  14.  
  15.     if( contor > 0 )
  16.     {
  17.         for( new i = 1 ; i <= 32; i++)
  18.         {
  19.             len += format( message[ len ], charsmax( message ) - len, "!y%s%s ", vip_name[ i ], i < ( contor  ) ? ", " : "");
  20.             if(len > 96 )
  21.             {
  22.                 color_chat( id, message );
  23.                 len = format( message, charsmax( message ), "%s ");
  24.             }
  25.         }
  26.         color_chat( id, message);
  27.     }
  28.     else
  29.     {
  30.         len += format( message[ len ], charsmax( message ) - len, "Nincs VIP online.");
  31.         color_chat( id, message );
  32.     }
  33.     return PLUGIN_CONTINUE;
  34. }

Oldal: 1 / 1 Minden időpont UTC+02:00 időzóna szerinti
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/