Advertisement
HigorGamer

[FS] Salvar Armas

Nov 15th, 2014
923
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.42 KB | None | 0 0
  1. #include <a_samp>
  2. #include <DOF2>
  3. #include <zcmd>
  4. new Arma[5];
  5. new Bala[5];
  6. // criado Por HigorGamer
  7. public OnPlayerSpawn(playerid)
  8. {
  9.         CarregarArmas(playerid);
  10.     return 1;
  11. }
  12. public OnPlayerConnect(playerid)
  13. {
  14.     DOF2_Exit();
  15.     return 1;
  16. }
  17. public OnPlayerDisconnect(playerid, reason)
  18. {
  19.     new string[100];
  20.     format(string, sizeof(string), "%s.ini", PlayerName(playerid));
  21.     new weapons[13];
  22.     new balas[13];
  23.  
  24.     GetPlayerWeaponData(playerid, 1, weapons[1], balas[1]);
  25.     DOF2_SetInt(string, "Arma1",weapons[1]);
  26.     DOF2_SetInt(string, "Bala1",balas[1]);
  27.  
  28.     GetPlayerWeaponData(playerid, 2, weapons[2], balas[2]);
  29.     DOF2_SetInt(string, "Arma2",weapons[2]);
  30.     DOF2_SetInt(string, "Bala2",balas[2]);
  31.  
  32.     GetPlayerWeaponData(playerid, 3, weapons[3], balas[3]);
  33.     DOF2_SetInt(string, "Arma3",weapons[3]);
  34.     DOF2_SetInt(string, "Bala3",balas[3]);
  35.  
  36.     GetPlayerWeaponData(playerid, 4, weapons[4], balas[4]);
  37.     DOF2_SetInt(string, "Arma4",weapons[4]);
  38.     DOF2_SetInt(string, "Bala4",balas[4]);
  39.  
  40.     GetPlayerWeaponData(playerid, 5, weapons[5], balas[5]);
  41.     DOF2_SetInt(string, "Arma5",weapons[5]);
  42.     DOF2_SetInt(string, "Bala5",balas[5]);
  43.  
  44.     DOF2_SaveFile();
  45.     DOF2_Exit();
  46.     return 1;
  47. }
  48. CMD:salvar(playerid)
  49. {
  50.     new string[100];
  51.     format(string, sizeof(string), "%s.ini", PlayerName(playerid));
  52.     new weapons[13];
  53.     new balas[13];
  54.    
  55.     GetPlayerWeaponData(playerid, 1, weapons[1], balas[1]);
  56.     DOF2_SetInt(string, "Arma1",weapons[1]);
  57.     DOF2_SetInt(string, "Bala1",balas[1]);
  58.  
  59.     GetPlayerWeaponData(playerid, 2, weapons[2], balas[2]);
  60.     DOF2_SetInt(string, "Arma2",weapons[2]);
  61.     DOF2_SetInt(string, "Bala2",balas[2]);
  62.    
  63.     GetPlayerWeaponData(playerid, 3, weapons[3], balas[3]);
  64.     DOF2_SetInt(string, "Arma3",weapons[3]);
  65.     DOF2_SetInt(string, "Bala3",balas[3]);
  66.  
  67.     GetPlayerWeaponData(playerid, 4, weapons[4], balas[4]);
  68.     DOF2_SetInt(string, "Arma4",weapons[4]);
  69.     DOF2_SetInt(string, "Bala4",balas[4]);
  70.    
  71.     GetPlayerWeaponData(playerid, 5, weapons[5], balas[5]);
  72.     DOF2_SetInt(string, "Arma5",weapons[5]);
  73.     DOF2_SetInt(string, "Bala5",balas[5]);
  74.    
  75.     DOF2_SaveFile();
  76.     DOF2_Exit();
  77.     SendClientMessage(playerid,-1,"salvo!");
  78.     return 1;
  79. }
  80. stock CarregarArmas(playerid)
  81. {
  82.         PlayerPlaySound(playerid, 1056, 0.0, 0.0, 0.0);
  83.     new string[100];
  84.     format(string, sizeof(string), "%s.ini", PlayerName(playerid));
  85.         Arma[0] = DOF2_GetInt(string, "Arma1");
  86.         Bala[0] = DOF2_GetInt(string, "Bala1");
  87.         Arma[1] = DOF2_GetInt(string, "Arma2");
  88.         Bala[1] = DOF2_GetInt(string, "Bala2");
  89.         Arma[2] = DOF2_GetInt(string, "Arma3");
  90.         Bala[2] = DOF2_GetInt(string, "Bala3");
  91.         Arma[3] = DOF2_GetInt(string, "Arma4");
  92.         Bala[3] = DOF2_GetInt(string, "Bala4");
  93.         Arma[4] = DOF2_GetInt(string, "Arma5");
  94.         Bala[4] = DOF2_GetInt(string, "Bala5");
  95.     GivePlayerWeapon(playerid , Arma[0], Bala[0]);
  96.     GivePlayerWeapon(playerid , Arma[1], Bala[1]);
  97.     GivePlayerWeapon(playerid , Arma[2], Bala[2]);
  98.     GivePlayerWeapon(playerid , Arma[3], Bala[3]);
  99.     GivePlayerWeapon(playerid , Arma[4], Bala[4]);
  100.     return 1;
  101. }
  102. CMD:delarmas(playerid)return ResetPlayerWeapons(playerid);
  103.  
  104. CMD:kit1(playerid)
  105. {
  106.     GivePlayerWeapon(playerid , 1, 10);
  107.     GivePlayerWeapon(playerid , 6, 10);
  108.     GivePlayerWeapon(playerid , 16, 10);
  109.     GivePlayerWeapon(playerid , 27, 10);
  110.     GivePlayerWeapon(playerid , 29, 10);
  111.     return 1;
  112. }
  113.  
  114. stock PlayerName(playerid)
  115. {
  116.     new name[MAX_PLAYER_NAME];
  117.     GetPlayerName(playerid,name,sizeof(name));
  118.     return name;
  119. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement