27.08.2012, 21:07
Quote:
Pedro foi mais rбpido... que pena...
Obs: Crie a pasta Armas. Код:
#include <a_samp> #include <DOF2> public OnPlayerSpawn(playerid) { LoadWeapons(playerid); return 1; } public OnGameModeExit() { DOF2_Exit(); return 1; } public OnPlayerDisconnect(playerid) { SaveWeapons(playerid); return 1; } SaveWeapons(playerid) { new weapons[13][2], wstring[56], armap[24]; format(wstring, sizeof(wstring), "Armas/%s.ini", GetNick(playerid)); if(!DOF2_FileExists(wstring)) DOF2_CreateFile(wstring); if(DOF2_FileExists(wstring)) { for (new i = 0; i < 13; i++) { GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]); format(armap, sizeof(armap), "Weapon%d", i); DOF2_SetInt(wstring, armap, weapons[i][0]); format(armap, sizeof(armap), "Ammo%d", i); DOF2_SetInt(wstring, armap, weapons[i][1]); } DOF2_SaveFile(); print("Armas Salvas"); } return 1; } LoadWeapons(playerid) { new wstring[56], armap[24], weapons[13][2]; format(wstring, sizeof(wstring), "Armas/%s.ini", GetNick(playerid)); if(!DOF2_FileExists(wstring)) return 1; if(DOF2_FileExists(wstring)) { for (new i = 0; i < 13; i++) { format(armap, sizeof(armap), "Weapon%d", i); weapons[i][0] = DOF2_GetInt(wstring, armap); format(armap, sizeof(armap), "Ammo%d", i); weapons[i][1] = DOF2_GetInt(wstring, armap); if(weapons[i][0] != 0) GivePlayerWeapon(playerid, weapons[i][0], weapons[i][1]); } print("Armas Carregadas"); } return 1; } GetNick(playerid) { new name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, MAX_PLAYER_NAME); return name; } Bom uso... |