Advertisement
Guest User

whbbeudbkjuevyu budbygewuf iubsy fbewiu gub xgdnuyyu6cgnxtgd

a guest
Jan 21st, 2013
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.57 KB | None | 0 0
  1. #include <a_samp>
  2. #include <zcmd>
  3. #include <sscanf2>
  4. #include <YSI\y_ini>
  5.  
  6. new
  7. Float: PosX[ MAX_PLAYERS ],
  8. Float: PosY[ MAX_PLAYERS ],
  9. Float: PosZ[ MAX_PLAYERS ],
  10. Float: Angle[ MAX_PLAYERS ],
  11. Interior[ MAX_PLAYERS ],
  12. VirtualWorld[ MAX_PLAYERS ]
  13. ;
  14.  
  15. stock user_ini_file(playerid)
  16. {
  17. new
  18. string[ 128 ],
  19. user_name[ MAX_PLAYER_NAME ]
  20. ;
  21.  
  22. GetPlayerName( playerid, user_name, MAX_PLAYER_NAME );
  23. format( string, sizeof ( string ), "%s.ini", user_name );
  24. /* scriptfiles directory */
  25. return
  26. string;
  27. }
  28.  
  29. forward @load_user_position( playerid, name[], value[] );
  30.  
  31. @load_user_position( playerid, name[], value[] )
  32. {
  33. INI_Float( "PositionX", PosX[ playerid ] );
  34. INI_Float( "PositionY", PosY[ playerid ] );
  35. INI_Float( "PositionZ", PosZ[ playerid ] );
  36. INI_Float( "Angle", Angle[ playerid ] );
  37. INI_Int( "Interior", Interior[ playerid ] );
  38. INI_Int( "VirtualWorld", VirtualWorld[ playerid ] );
  39. return ( 1 );
  40. }
  41.  
  42. public OnPlayerConnect(playerid)
  43. {
  44. PosX[ playerid ] = 0;
  45. PosY[ playerid ] = 0;
  46. PosZ[ playerid ] = 0;
  47. Angle[ playerid ] = 0;
  48. Interior[ playerid ] = 0;
  49. VirtualWorld[ playerid ] = 0;
  50.  
  51. INI_ParseFile( user_ini_file( playerid ), "load_user_%s", .bExtra = true, .extra = playerid );
  52. return 1;
  53. }
  54.  
  55. public OnPlayerDisconnect(playerid, reason)
  56. {
  57. GetPlayerPos( playerid, PosX[ playerid ], PosY[ playerid ], PosZ[ playerid ] );
  58. GetPlayerFacingAngle( playerid, Angle[ playerid ] );
  59.  
  60. new INI:File = INI_Open( user_ini_file( playerid ) );
  61. INI_SetTag( File, "position" );
  62. INI_WriteFloat( File, "PositionX", PosX[ playerid ] );
  63. INI_WriteFloat( File, "PositionY", PosY[ playerid ] );
  64. INI_WriteFloat( File, "PositionZ", PosZ[ playerid ] );
  65. INI_WriteFloat( File, "Angle", Angle[ playerid ] );
  66. INI_WriteInt( File, "Interior", GetPlayerInterior( playerid ) );
  67. INI_WriteInt( File, "VirtualWorld", GetPlayerVirtualWorld( playerid ) );
  68. INI_Close( File );
  69. return 1;
  70. }
  71.  
  72. public OnPlayerSpawn( playerid )
  73. {
  74. if ( PosX[ playerid ] != 0 && PosY[ playerid ] != 0 && PosZ[ playerid ] != 0 )
  75. {
  76. SetPlayerPos( playerid, PosX[ playerid ], PosY[ playerid ], PosZ[ playerid ] );
  77. SetPlayerFacingAngle( playerid, Angle[ playerid ] );
  78. SetPlayerInterior( playerid, Interior[ playerid ] );
  79. SetPlayerVirtualWorld( playerid, VirtualWorld[ playerid ] );
  80. SendClientMessage( playerid, COLOR_GREEN, "[Essentials] Player data loaded!" );
  81. }
  82. return ( 1 );
  83. }
  84.  
  85. // Not the full script btw
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement