Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include a_samp
- #include dof2
- #include sscanf2
- #include pawn.cmd
- #include <YSI_Coding\y_va>
- main(){}
- public OnGameModeExit()
- {
- DOF2::Exit();
- return 1;
- }
- GetPlayerNamef(playerid)
- {
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid, name, MAX_PLAYER_NAME);
- return name;
- }
- GetWeaponNamef(weaponid)
- {
- new name[16];
- GetWeaponName(weaponid, name, 16);
- return name;
- }
- playerFile(playerid)
- {
- new file[MAX_PLAYER_NAME + 16];
- format(file, sizeof(file), "Contas/%s.ini", GetPlayerNamef(playerid));
- return file;
- }
- IsPlayerArmed(playerid)
- {
- new weapons[2];
- for(new i; i < 13; i++)
- {
- GetPlayerWeaponData(playerid, i, weapons[0], weapons[1]);
- if(weapons[0] != 0)
- return 1;
- }
- return 0;
- }
- CMD:armar(playerid, params[])
- {
- if(!IsPlayerAdmin(playerid))
- return SendClientMessage(playerid, -1, "* Você não tem permissão.");
- new id, weaponid, ammo;
- if(sscanf(params, "uii", id, weaponid, ammo))
- return SendClientMessage(playerid, -1, "* /armar (id) (arma-id) (munição)");
- if(!IsPlayerConnected(id))
- return SendClientMessage(playerid, -1, "* ID inválido.");
- if(!(1 <= weaponid <= 46))
- return SendClientMessage(playerid, -1, "* Arma inválida.");
- if(ammo <= 0)
- return SendClientMessage(playerid, -1, "* Munição inválida.");
- GivePlayerWeapon(id, weaponid, ammo);
- va_SendClientMessage(playerid, -1, "* Você armou o jogador %s com a arma %s com %i de munição.", GetPlayerNamef(id), GetWeaponNamef(weaponid), ammo);
- return 1;
- }
- CMD:salvar(playerid)
- {
- if(!IsPlayerArmed(playerid))
- return SendClientMessage(playerid, -1, "* Você não possui nenhuma arma.");
- new weapons[2], weapStr[16];
- if(!DOF2::FileExists(playerFile(playerid)))
- DOF2::CreateFile(playerFile(playerid));
- for(new i; i < 13; i++)
- {
- GetPlayerWeaponData(playerid, i, weapons[0], weapons[1]);
- if(weapons[0] != 0)
- {
- format(weapStr, sizeof(weapStr), "arma-%i", i);
- DOF2::SetInt(playerFile(playerid), weapStr, weapons[0]);
- format(weapStr, sizeof(weapStr), "munição-%i", i);
- DOF2::SetInt(playerFile(playerid), weapStr, weapons[1]);
- }
- }
- DOF2::SaveFile();
- SendClientMessage(playerid, -1, "* Você salvou todas as suas armas em sua conta.");
- return 1;
- }
- CMD:carregar(playerid)
- {
- if(!DOF2::FileExists(playerFile(playerid)))
- return SendClientMessage(playerid, -1, "* Você não tem armas para carregar.");
- new weapStr[10], ammoStr[16];
- for(new i; i < 13; i++)
- {
- format(weapStr, sizeof(weapStr), "arma-%i", i);
- format(ammoStr, sizeof(ammoStr), "munição-%i", i);
- GivePlayerWeapon(playerid, DOF2::GetInt(playerFile(playerid), weapStr), DOF2::GetInt(playerFile(playerid), ammoStr));
- }
- SendClientMessage(playerid, -1, "* Você carregou todas as armas salvas em sua conta.");
- return 1;
- }
Advertisement
RAW Paste Data
Copied
Advertisement