Advertisement
Darky

Pickup Maker [0.3x]

Feb 3rd, 2013
608
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.10 KB | None | 0 0
  1. //______________________________________________________________________________
  2. #include                                                         <    a_samp   >
  3. #include                                                         <     zcmd    >
  4. #include                                                         <   streamer  >
  5. #include                                                         <    sscanf2  >
  6. //______________________________________________________________________________
  7. #define SAVE_FILE                                                  "pickups.cfg"
  8. #define SCM                                                    SendClientMessage
  9. //______________________________________________________________________________
  10. public OnFilterScriptInit ( ) { LoadPickup ( SAVE_FILE ) ; return (1) ; }
  11. public OnFilterScriptExit ( ) { DestroyAllDynamicPickups ( ) ; return (1) ; }
  12. //______________________________________________________________________________
  13. CMD:pickup( playerid , params [ ] ) {
  14.     if ( IsPlayerAdmin ( playerid ) ) {
  15.     new model , type , Float:x , Float:y , Float:z , string [ 128 ]            ;
  16.     if ( unformat ( params , "ih" , model , type ) ) return SCM ( playerid , 0xFFFFFFFF ,"USAGE: /pickup [id] [type]" ) ;
  17.     GetPlayerPos ( playerid , x , y , z )                                      ;
  18.     SavePickup ( SAVE_FILE , x , y , z , model , type )                        ;
  19.     CreateDynamicPickup ( model , type , x , y , z , -1 , -1 , -1 , 100.0 )    ;
  20.     format ( string , sizeof ( string ) , "[MAKER] Pickup maked.Model:\"%d\" and type: \"%d\"!" , model , type ) ;
  21.     SCM ( playerid , 0xFFFFFFFF , string )                                     ; }
  22.     return (1) ; }
  23. //______________________________________________________________________________
  24. stock LoadPickup ( pFilename [ ] ) {
  25.     if ( ! fexist ( pFilename ) ) return (0)                                   ;
  26.     new File:pFile , type , model , Float:x , Float:y , Float:z , total , line [ 128 ] ;
  27.     pFile = fopen ( pFilename , io_read )                                      ;
  28.     while ( fread ( pFile , line ) ) {
  29.         if ( line [ 0 ] == '/' || isnull ( line ) ) continue                   ;
  30.         unformat ( line , "fffii" , x , y , z , model , type )                 ;
  31.         CreateDynamicPickup ( model , type , x , y , z , -1 , -1 , -1 , 100.0 ) ;
  32.         total++                                                                ; }
  33.     fclose ( pFile )                                                           ;
  34.     return total ; }
  35. //______________________________________________________________________________
  36. stock SavePickup ( pFilename [ ] , Float:x , Float:y , Float:z , model , type) {
  37.     new File:pFile , line [ 128 ]                                              ;
  38.     format ( line , sizeof ( line ) , "%f %f %f %i %i\r\n" , x , y , z , model , type ) ;
  39.     pFile = fopen ( pFilename , io_append )                                    ;
  40.     fwrite ( pFile , line )                                                    ;
  41.     fclose ( pFile )                                                           ;
  42.     return (1) ; }
  43. //______________________________________________________________________________
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement