26/02/2014, 08:50 PM
Hola , encontre un sistema de party en mi PC.
Decidi provarlo en mi zp y me gusto , solo que no andaba.
Lo arregle,lo adapte y ahora lo vengo a dejar aca.
Caracteristicas ;
-Anda en ZP 4.2 , no se si anda en 4.3
-No se de quien es
-Este party lo tenia un ZP llamado Zombie Rampage.(ya es bastante viejo y seguro muchos no lo junan)(creo que este zp lo iso L//)
Empezamos;
//Debajo de los includes colocamos
// En public plugin_init() colocamos
// En public client_putinserver( id ) , debajo de { colocamos
// y por ultimo colocamos esto al final del ZP
Decidi provarlo en mi zp y me gusto , solo que no andaba.
Lo arregle,lo adapte y ahora lo vengo a dejar aca.
Caracteristicas ;
-Anda en ZP 4.2 , no se si anda en 4.3
-No se de quien es
-Este party lo tenia un ZP llamado Zombie Rampage.(ya es bastante viejo y seguro muchos no lo junan)(creo que este zp lo iso L//)
Empezamos;
//Debajo de los includes colocamos
Código PHP:
#define IsPlayer(%1) ( 1 <= %1 <= g_iMaxPlayers )
const g_iMaxGroups = 2;
new g_iMaxPlayers;
new g_iPlayerGroups[ 33 ][ g_iMaxGroups ];
new g_iGroupIndex = -1;
new Is_User_in_Party[33];
new FriendName[33];
new PlayerInvitations[33];
new InvitatorName[33]
const KEYSMENU = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9)
// En public plugin_init() colocamos
Código PHP:
register_plugin( "Sistema de Party", "3.3", "Author : NO SE" )
register_menu( "Menu De Party", KEYSMENU, "HandlePartyMenu" )
register_menu( "Invitaciones", KEYSMENU, "HandleInvitations" )
register_clcmd( "say /party", "ShowPartyMenu" )
g_iMaxPlayers = get_maxplayers()
}
// En public client_putinserver( id ) , debajo de { colocamos
Código PHP:
Is_User_in_Party[id] = 0
PlayerInvitations[id] = 0
}
// y por ultimo colocamos esto al final del ZP
Código PHP:
public ShowPartyMenu( id )
{
static Menu[250], iLen
iLen = 0
iLen += formatex(Menu[iLen], sizeof Menu - 1 - iLen, "\yMenu de party^n^n")
iLen += formatex(Menu[iLen], sizeof Menu - 1 - iLen, "\w-------------------------^n")
if(Is_User_in_Party[id])
{
new Name[33]
get_user_name(id, Name, charsmax(Name))
iLen += formatex(Menu[iLen], sizeof Menu - 1 - iLen, "\r - \y%s & %s^n", Name, FriendName[id])
}
else
{
iLen += formatex(Menu[iLen], sizeof Menu - 1 - iLen, "\r - \dNo estas en party^n")
}
iLen += formatex(Menu[iLen], sizeof Menu - 1 - iLen, "\w-------------------------^n^n")
iLen += formatex(Menu[iLen], sizeof Menu - 1 - iLen, "\r5. \w%s^n", Is_User_in_Party[id] ? "Salir del PARTY" : "Invitar" )
iLen += formatex(Menu[iLen], sizeof Menu - 1 - iLen, "\r6. \w%s ^n^n^n", PlayerInvitations[id]==1 ? "Invitacion:" : "No tienes ninguna invitacion" )
iLen += formatex(Menu[iLen], sizeof Menu - 1 - iLen, "^n\r0. \wSalir")
show_menu(id, KEYSMENU, Menu, -1, "Menu De Party")
}
public HandlePartyMenu( id, key )
{
switch( key )
{
case 4:
{
new szArg[ 32 ] , id2;
read_argv( 1 , szArg , 31 );
id2 = read_data(2)
if( !Is_User_in_Party[id] )
{
new Target, body
get_user_aiming(id, Target, body)
if( Target != id2 || Target == id || !is_user_bot(id2) || !is_user_connected(id2) || !is_user_alive(id2) )
{
client_print( id , print_center , "[PARTY] No estas apuntando a nadie!");
ShowPartyMenu( id )
return PLUGIN_HANDLED;
}
for ( new i = 1 ; i <= g_iMaxPlayers ; i++ )
{
for ( new p = 0 ; p < g_iMaxGroups ; p++ )
{
get_user_name( id2 , szArg , 31 );
if ( g_iPlayerGroups[ i ][ p ] & ( 1 << ( id2 & 31 ) ) )
{
switch(PlayerInvitations[id] )
{
case 1: client_print( id , print_chat , "[PARTY] %s Ya esta en un party!!" , szArg );
case 2: client_print( id , print_chat , "[PARTY] %s Ya tiene una invitacion" , szArg );
}
return PLUGIN_HANDLED;
}
else
{
client_print( id , print_chat , "[PARTY] Invitaste a %s a un party!!" , szArg );
new szName[32]
get_user_name(id, szName, 31 )
PlayerInvitations[id2] = 1
copy( InvitatorName[id2], charsmax( InvitatorName ), szName )
return PLUGIN_HANDLED;
}
}
}
return PLUGIN_CONTINUE;
}
if( id2 == id )
return PLUGIN_HANDLED;
if( Is_User_in_Party[id] && Is_User_in_Party[id2] )
{
Is_User_in_Party[id] = 0;
Is_User_in_Party[id2] = 0;
PlayerInvitations[id] = 0;
PlayerInvitations[id2] = 0;
client_print( id, print_chat, "[PARTY] El party ha sido disuelto." )
client_print( id2, print_chat, "[PARTY] El party ha sido disuelto." )
return PLUGIN_HANDLED;
}
return PLUGIN_HANDLED;
}
case 5: ShowInvitationsMenu( id )
}
return PLUGIN_HANDLED;
}
public ShowInvitationsMenu( id )
{
static Menu[250], iLen
iLen = 0
iLen += formatex(Menu[iLen], sizeof Menu - 1 - iLen, "\yMenu de Invitaciones^n^n")
switch( PlayerInvitations[id] )
{
case 0: iLen += formatex(Menu[iLen], sizeof Menu - 1 - iLen, "\w No tenes ninguna invitacion^n" )
case 1: iLen += formatex(Menu[iLen], sizeof Menu - 1 - iLen, "\r1. - \w Invitacion^n")
}
iLen += formatex(Menu[iLen], sizeof Menu - 1 - iLen, "^n\r0. \wSalir")
show_menu(id, KEYSMENU, Menu, -1, "Invitaciones")
}
public HandleInvitations( id, key )
{
switch( key )
{
case 0:
{
if( PlayerInvitations[id] == 1 )
{
PlayerInvitatorMenu( id )
}
}
}
}
public PlayerInvitatorMenu( id )
{
new iInviteSender[ 1 ], iMenu;
new szMenuTitle[ 55 ];
formatex( szMenuTitle[ get_user_name( id , szMenuTitle , charsmax( szMenuTitle ) ) ] , 55 , " Te esta invitando a party!" );
iInviteSender[ 0 ] = id;
iMenu = menu_create( szMenuTitle , "InviteHandler");
menu_additem( iMenu , "Aceptar", iInviteSender , 0 );
menu_additem( iMenu , "Cancelar", iInviteSender , 0 );
menu_setprop( iMenu , MPROP_EXIT , MEXIT_ALL );
menu_display( id , iMenu );
return PLUGIN_HANDLED;
}
public InviteHandler( id , iMenu , iItem )
{
if( iItem == MENU_EXIT )
return PLUGIN_HANDLED;
new szName1[ 33 ] , szName2[ 33 ], szKey[ 7 ] , iDummy , idInviteSender;
menu_item_getinfo( iMenu , iItem , iDummy , szKey , 1 , "" , 0 , iDummy );
idInviteSender = szKey[ 0 ];
get_user_name( idInviteSender , szName1 , charsmax( szName1 ) );
get_user_name( id , szName2 , charsmax( szName2 ) );
if ( iItem == 0 )
{
for ( new p = 0 ; p < g_iMaxGroups ; p++ )
{
if ( g_iPlayerGroups[ id ][ p ] & ( 1 << ( idInviteSender & 31 ) ) )
{
new szArg[ 32 ]
get_user_name( id, szArg, 31 )
switch( PlayerInvitations[idInviteSender] )
{
case 1: client_print( id , print_chat , "[PARTY] %s Ya esta en un party!!" , szArg );
case 2: client_print( id , print_chat , "[PARTY] %s Ya tiene una invitacion" , szArg );
}
}
else
{
if ( is_user_connected( idInviteSender ) && is_user_connected( id ) )
{
AddGroup( idInviteSender , id );
set_hudmessage( 255 , 255 , 255 , 0.05 , 0.25 , 0 , 6.0 , 10.0 );
show_hudmessage( idInviteSender, "Estas en party con %s" , szName2 );
show_hudmessage( id, "Estas en party con %s" , szName1 );
Is_User_in_Party[id] = 1;
Is_User_in_Party[idInviteSender] = 1;
copy( FriendName[id], charsmax(FriendName), szName1 )
PlayerInvitations[id] = 2
}
}
}
}
else if ( iItem == 1 )
{
client_print( idInviteSender , print_chat , "[PARTY] %s Ha cancelado tu invitacion." , szName2);
client_print( id , print_chat , "[PARTY] Cancelaste la invitacion de %s" , szName1 );
PlayerInvitations[id] = 0
return PLUGIN_HANDLED;
}
return PLUGIN_HANDLED;
}
public AddGroup( idInvitor , idInvitee )
{
if ( ++g_iGroupIndex == g_iMaxGroups )
return 0;
g_iPlayerGroups[ idInvitor ][ g_iGroupIndex ] = ( 1 << ( idInvitor & 31 ) ) | ( 1 << ( idInvitee & 31 ) );
return g_iGroupIndex;
}
public GetGroupPlayers( iGroup , &id1 , &id2 )
{
new bool:bFirstSet;
for ( new p = 1 ; p <= 32 ; p++ )
{
if ( iGroup & ( 1 << ( p & 31 ) ) )
{
if ( !bFirstSet )
{
id1 = p;
bFirstSet = true;
}
else
{
id2 = p;
return 1;
}
}
}
return 0;
}