Advertisement
Luk4s

[MySQL R7] Weapons

Jan 29th, 2013
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.16 KB | None | 0 0
  1. new WeaponInfo[MAX_PLAYERS][13][2];
  2.  
  3. // Žaidėjas užsiregistruoja
  4. mysql_format(ConnectionHandle, query, "INSERT INTO `weapons` (Name) VALUES ('%s')", PlayerName(playerid));
  5. mysql_function_query(ConnectionHandle, query, false, "", "");
  6.  
  7. // Ginklų informacijos saugojimas [OnPlayerDisconnect]
  8. for(new i = 0; i < 13; i++)
  9. {
  10.     GetPlayerWeaponData(playerid, i, WeaponInfo[playerid][i][0], WeaponInfo[playerid][i][1]);
  11.     mysql_format(ConnectionHandle, query, "UPDATE `weapons` SET `Weapon%i` = '%i', `Ammo%i` = '%i' WHERE `Name` = '%s'", i, WeaponInfo[playerid][i][0], i, WeaponInfo[playerid][i][1], PlayerName(playerid));
  12.     mysql_function_query(ConnectionHandle, query, false, "", "");
  13. }
  14.  
  15. // Ginklų informacijos krovimas [OnPlayerSpawn]
  16. new _string[14], _tempstr[11];
  17. for(new i = 0; i < 13; i++)
  18. {
  19.     format(_string, sizeof(_string), "Weapon%i", i);
  20.     cache_get_field_content(0, _string, _tempstr);
  21.     WeaponInfo[playerid][i][0] = strval(_tempstr);
  22.  
  23.     format(_string, 12, "Ammo%i", i);
  24.     cache_get_field_content(0, _string, _tempstr);
  25.     WeaponInfo[playerid][i][1] = strval(_tempstr);
  26.                
  27.     GivePlayerWeapon(playerid, WeaponInfo[playerid][i][0], WeaponInfo[playerid][i][1]);
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement