fixes the business member management (removing from business)
This commit is contained in:
parent
af8fad34ed
commit
0bff900b1b
@ -1030,24 +1030,31 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
|
|||||||
if ( listitem == 0 )
|
if ( listitem == 0 )
|
||||||
return ShowPlayerDialog( playerid, DIALOG_BUSINESS_ADD_MEMBER, DIALOG_STYLE_INPUT, ""COL_GREY"Business System", ""COL_WHITE"Type the name of the player you wish to add as a member.", "Add", "Back" );
|
return ShowPlayerDialog( playerid, DIALOG_BUSINESS_ADD_MEMBER, DIALOG_STYLE_INPUT, ""COL_GREY"Business System", ""COL_WHITE"Type the name of the player you wish to add as a member.", "Add", "Back" );
|
||||||
|
|
||||||
new memberid = g_businessMemberIndex[ playerid ][ listitem ];
|
for( new i, x = 1; i < MAX_BUSINESS_MEMBERS; i ++ )
|
||||||
|
|
||||||
if ( g_businessData[ businessid ] [ E_MEMBERS ] [ memberid ] )
|
|
||||||
{
|
{
|
||||||
printf( "[business remove member] {user: %d, businessid: %d}", g_businessData[ businessid ] [ E_MEMBERS ] [ memberid ], businessid );
|
if ( g_businessData[ businessid ] [ E_MEMBERS ] [ i ] )
|
||||||
|
{
|
||||||
|
if ( x == listitem )
|
||||||
|
{
|
||||||
|
if ( g_Debugging ) {
|
||||||
|
printf( "[business remove member] {listitem: %d, user: %d, businessid: %d}", x, g_businessData[ businessid ] [ E_MEMBERS ] [ i ], businessid );
|
||||||
|
}
|
||||||
// alert player if online
|
// alert player if online
|
||||||
foreach (new p : Player) if ( g_businessData[ businessid ] [ E_MEMBERS ] [ memberid ] == p_AccountID[ p ] ) {
|
foreach (new p : Player) if ( g_businessData[ businessid ] [ E_MEMBERS ] [ i ] == p_AccountID[ p ] ) {
|
||||||
SendServerMessage( p, "You have been removed as a member of "COL_GREY"%s"COL_WHITE".", g_businessData[ businessid ] [ E_NAME ] );
|
SendServerMessage( p, "You have been removed as a member of "COL_GREY"%s"COL_WHITE".", g_businessData[ businessid ] [ E_NAME ] );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// null entry
|
// null entry
|
||||||
g_businessData[ businessid ] [ E_MEMBERS ] [ memberid ] = 0;
|
g_businessData[ businessid ] [ E_MEMBERS ] [ i ] = 0;
|
||||||
|
|
||||||
// save
|
// save
|
||||||
UpdateBusinessData( businessid ), UpdateBusinessTitle( businessid );
|
UpdateBusinessData( businessid ), UpdateBusinessTitle( businessid );
|
||||||
SendServerMessage( playerid, "You have removed a member from the business." );
|
SendServerMessage( playerid, "You have removed a member from the business." );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
x ++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ShowBusinessMembers( playerid, businessid );
|
ShowBusinessMembers( playerid, businessid );
|
||||||
@ -1672,6 +1679,8 @@ stock UpdateBusinessData( businessid )
|
|||||||
for ( new i = 0; i < MAX_BUSINESS_MEMBERS; i ++ )
|
for ( new i = 0; i < MAX_BUSINESS_MEMBERS; i ++ )
|
||||||
format( members, sizeof( members ), "%s%d ", members, g_businessData[ businessid ] [ E_MEMBERS ] [ i ] );
|
format( members, sizeof( members ), "%s%d ", members, g_businessData[ businessid ] [ E_MEMBERS ] [ i ] );
|
||||||
|
|
||||||
|
print( members );
|
||||||
|
|
||||||
format( szLargeString, sizeof( szLargeString ), "UPDATE `BUSINESSES` SET `OWNER_ID`=%d,`NAME`='%s',`SUPPLIES`=%d,`PRODUCT`=%d,`MEMBERS`='%s',`PROD_TIMESTAMP`=%d,`BANK`=%d,`SECURITY`=%d WHERE `ID`=%d",
|
format( szLargeString, sizeof( szLargeString ), "UPDATE `BUSINESSES` SET `OWNER_ID`=%d,`NAME`='%s',`SUPPLIES`=%d,`PRODUCT`=%d,`MEMBERS`='%s',`PROD_TIMESTAMP`=%d,`BANK`=%d,`SECURITY`=%d WHERE `ID`=%d",
|
||||||
g_businessData[ businessid ] [ E_OWNER_ID ], mysql_escape( g_businessData[ businessid ] [ E_NAME ] ), g_businessData[ businessid ] [ E_SUPPLIES ], g_businessData[ businessid ] [ E_PRODUCT ],
|
g_businessData[ businessid ] [ E_OWNER_ID ], mysql_escape( g_businessData[ businessid ] [ E_NAME ] ), g_businessData[ businessid ] [ E_SUPPLIES ], g_businessData[ businessid ] [ E_PRODUCT ],
|
||||||
members, g_businessData[ businessid ] [ E_PROD_TIMESTAMP ], g_businessData[ businessid ] [ E_BANK ], g_businessData[ businessid ] [ E_SECURITY_LEVEL ], businessid );
|
members, g_businessData[ businessid ] [ E_PROD_TIMESTAMP ], g_businessData[ businessid ] [ E_BANK ], g_businessData[ businessid ] [ E_SECURITY_LEVEL ], businessid );
|
||||||
@ -2023,7 +2032,7 @@ stock ShowBusinessMembers( playerid, businessid )
|
|||||||
format( szMembers, sizeof( szMembers ), "%s,%d", szMembers, g_businessData[ businessid ] [ E_MEMBERS ] [ i ] );
|
format( szMembers, sizeof( szMembers ), "%s,%d", szMembers, g_businessData[ businessid ] [ E_MEMBERS ] [ i ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
format( szBigString, sizeof( szBigString ), "SELECT `NAME` FROM `USERS` WHERE `ID` IN (%s)", szMembers );
|
format( szBigString, sizeof( szBigString ), "SELECT `ID`, `NAME` FROM `USERS` WHERE `ID` IN (%s) ORDER BY `ID`", szMembers );
|
||||||
mysql_function_query( dbHandle, szBigString, true, "OnShowBusinessMembers", "dd", playerid, businessid );
|
mysql_function_query( dbHandle, szBigString, true, "OnShowBusinessMembers", "dd", playerid, businessid );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -2031,7 +2040,7 @@ stock ShowBusinessMembers( playerid, businessid )
|
|||||||
function OnShowBusinessMembers( playerid, businessid )
|
function OnShowBusinessMembers( playerid, businessid )
|
||||||
{
|
{
|
||||||
new
|
new
|
||||||
count = 0, rows, fields, member[ MAX_PLAYER_NAME ];
|
rows, fields, member[ MAX_PLAYER_NAME ];
|
||||||
|
|
||||||
cache_get_data( rows, fields );
|
cache_get_data( rows, fields );
|
||||||
|
|
||||||
@ -2044,8 +2053,6 @@ function OnShowBusinessMembers( playerid, businessid )
|
|||||||
// get member name
|
// get member name
|
||||||
cache_get_field_content( i, "NAME", member, sizeof( member ) );
|
cache_get_field_content( i, "NAME", member, sizeof( member ) );
|
||||||
format( szBigString, sizeof( szBigString ), "%s%s\n", szBigString, member );
|
format( szBigString, sizeof( szBigString ), "%s%s\n", szBigString, member );
|
||||||
|
|
||||||
g_businessMemberIndex[ playerid ][ count ++ ] = i;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ShowPlayerDialog( playerid, DIALOG_BUSINESS_MEMBERS, DIALOG_STYLE_LIST, ""COL_GREY"Business System", szBigString, "Kick", "Back" );
|
ShowPlayerDialog( playerid, DIALOG_BUSINESS_MEMBERS, DIALOG_STYLE_LIST, ""COL_GREY"Business System", szBigString, "Kick", "Back" );
|
||||||
|
Loading…
Reference in New Issue
Block a user