Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected OnPresentCreated( createID )
- {
- presentsInfo[ createID ][ presSQLID ] = cache_insert_id();
- return(true);
- }
- // --
- protected OnPresentsLoad( )
- {
- new rows, fields, thisID, rowsCounter = 1;
- cache_get_data( rows, fields, mSQL );
- if( rows )
- {
- for( new i = 0; i < rows; i ++ )
- {
- thisID = rowsCounter;
- presentsInfo[ thisID ][ presSQLID ] = cache_get_field_content_int( i, "presSQLID" );
- presentsInfo[ thisID ][ presTaken ] = bool:cache_get_field_content_int( i, "presTaken" );
- presentsInfo[ thisID ][ presPlaced ] = bool:cache_get_field_content_int( i, "presPlaced" );
- presentsInfo[ thisID ][ presPos ][ 0 ] = cache_get_field_content_float( i, "presPos1" );
- presentsInfo[ thisID ][ presPos ][ 1 ] = cache_get_field_content_float( i, "presPos2" );
- presentsInfo[ thisID ][ presPos ][ 2 ] = cache_get_field_content_float( i, "presPos3" );
- presentsInfo[ thisID ][ presPos ][ 3 ] = cache_get_field_content_float( i, "presPos4" );
- presentsInfo[ thisID ][ presPos ][ 4 ] = cache_get_field_content_float( i, "presPos5" );
- presentsInfo[ thisID ][ presPos ][ 5 ] = cache_get_field_content_float( i, "presPos6" );
- new string[50];
- if( presentsInfo[ thisID ][ presPlaced ] )
- {
- new object = 19054;
- new rand = random( 5 );
- switch( rand )
- {
- case 0: object = 19054;
- case 1: object = 19055;
- case 2: object = 19056;
- case 3: object = 19057;
- case 4: object = 19058;
- }
- if( !presentsInfo[ thisID ][ presTaken ] )
- {
- format( string,sizeof( string ), "(/poklon)" );
- presentsInfo[ thisID ][ pres3d ] = CreateDynamic3DTextLabel( string, 0x00FF00FF, presentsInfo[ thisID ][ presPos ][ 0 ], presentsInfo[ thisID ][ presPos ][ 1 ], presentsInfo[ thisID ][ presPos ][ 2 ], 3.0, IPI, IVI, 0, 0, 0 );
- presentsInfo[ thisID ][ presObject ] = CreateDynamicObject( object, presentsInfo[ thisID ][ presPos ][ 0 ], presentsInfo[ thisID ][ presPos ][ 1 ], presentsInfo[ thisID ][ presPos ][ 2 ], presentsInfo[ thisID ][ presPos ][ 3 ], presentsInfo[ thisID ][ presPos ][ 4 ], presentsInfo[ thisID ][ presPos ][ 5 ] );
- }
- else if( presentsInfo[ thisID ][ presTaken ] )
- {
- format( string, sizeof( string ), "Poklon je otvoren." );
- presentsInfo[ thisID ][ pres3d ] = CreateDynamic3DTextLabel( string, 0xFF0000FF, presentsInfo[ thisID ][ presPos ][ 0 ], presentsInfo[ thisID ][ presPos ][ 1 ], presentsInfo[ thisID ][ presPos ][ 2 ], 3.0, IPI, IVI, 0, 0, 0 );
- presentsInfo[ thisID ][ presObject ] = CreateDynamicObject( object, presentsInfo[ thisID ][ presPos ][ 0 ], presentsInfo[ thisID ][ presPos ][ 1 ], presentsInfo[ thisID ][ presPos ][ 2 ], presentsInfo[ thisID ][ presPos ][ 3 ], presentsInfo[ thisID ][ presPos ][ 4 ], presentsInfo[ thisID ][ presPos ][ 5 ] );
- }
- }
- rowsCounter++;
- }
- }
- //
- new i = 0;
- for( new j = 1; j < MAX_PRESENTS; j++ )
- {
- if( presentsInfo[ j ][ presSQLID ] == -1 )
- {
- i = j;
- break;
- }
- }
- if( i != 0 ) return SendErrorMessage( playerid, "Vec je jedan poklon u procesu izgradnje, nije dovrsen, sacekajte(sigurnost baze)." );
- i = -1;
- for( new j = 1; j < MAX_PRESENTS; i++)
- {
- if( presentsInfo[ j ][ presSQLID ] == 0 )
- {
- i = j;
- break;
- }
- }
- if( presentsInfo[ (MAX_PRESENTS-1) ][ presSQLID ] != 0 ) return SendErrorMessage( playerid, "Ima maksimalno kreiranih poklona." );
- if( presentsInfo[i][presSQLID] != 0 ) return SendErrorMessage( playerid, "ID tog poklona vec postoji." );
- new Float:x, Float:y, Float:z, Float:angle;
- GetPlayerPos( playerid, x, y, z);
- GetPlayerFacingAngle( playerid, angle );
- presentsInfo[ i ][ presPos ][ 0 ] = x;
- presentsInfo[ i ][ presPos ][ 1 ] = y;
- presentsInfo[ i ][ presPos ][ 2 ] = z;
- presentsInfo[ i ][ presPos ][ 3 ] = 0;
- presentsInfo[ i ][ presPos ][ 4 ] = 0;
- presentsInfo[ i ][ presPos ][ 5 ] = 0;
- presentsInfo[ i ][ presTaken ] = false;
- presentsInfo[ i ][ presObject ] = CreateDynamicObject( 19054, x+2, y, z+0.6, 0.0, 0.0, angle );
- Streamer_Update( playerid );
- EditDynamicObject( playerid, presentsInfo[ i ][ presObject ] );
- EditPresents[ playerid ] = i;
- mSQL_CreatePresent( i );
- #else
- SendErrorMessage( playerid, "Nije ukljucen zimski mod." );
- #endif
- }
Advertisement
Add Comment
Please, Sign In to add comment