Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //______________________________________________________________________________
- #include < a_samp >
- #include < zcmd >
- #include < streamer >
- #include < sscanf2 >
- //______________________________________________________________________________
- #define SAVE_FILE "pickups.cfg"
- #define SCM SendClientMessage
- //______________________________________________________________________________
- public OnFilterScriptInit ( ) { LoadPickup ( SAVE_FILE ) ; return (1) ; }
- public OnFilterScriptExit ( ) { DestroyAllDynamicPickups ( ) ; return (1) ; }
- //______________________________________________________________________________
- CMD:pickup( playerid , params [ ] ) {
- if ( IsPlayerAdmin ( playerid ) ) {
- new model , type , Float:x , Float:y , Float:z , string [ 128 ] ;
- if ( unformat ( params , "ih" , model , type ) ) return SCM ( playerid , 0xFFFFFFFF ,"USAGE: /pickup [id] [type]" ) ;
- GetPlayerPos ( playerid , x , y , z ) ;
- SavePickup ( SAVE_FILE , x , y , z , model , type ) ;
- CreateDynamicPickup ( model , type , x , y , z , -1 , -1 , -1 , 100.0 ) ;
- format ( string , sizeof ( string ) , "[MAKER] Pickup maked.Model:\"%d\" and type: \"%d\"!" , model , type ) ;
- SCM ( playerid , 0xFFFFFFFF , string ) ; }
- return (1) ; }
- //______________________________________________________________________________
- stock LoadPickup ( pFilename [ ] ) {
- if ( ! fexist ( pFilename ) ) return (0) ;
- new File:pFile , type , model , Float:x , Float:y , Float:z , total , line [ 128 ] ;
- pFile = fopen ( pFilename , io_read ) ;
- while ( fread ( pFile , line ) ) {
- if ( line [ 0 ] == '/' || isnull ( line ) ) continue ;
- unformat ( line , "fffii" , x , y , z , model , type ) ;
- CreateDynamicPickup ( model , type , x , y , z , -1 , -1 , -1 , 100.0 ) ;
- total++ ; }
- fclose ( pFile ) ;
- return total ; }
- //______________________________________________________________________________
- stock SavePickup ( pFilename [ ] , Float:x , Float:y , Float:z , model , type) {
- new File:pFile , line [ 128 ] ;
- format ( line , sizeof ( line ) , "%f %f %f %i %i\r\n" , x , y , z , model , type ) ;
- pFile = fopen ( pFilename , io_append ) ;
- fwrite ( pFile , line ) ;
- fclose ( pFile ) ;
- return (1) ; }
- //______________________________________________________________________________
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement