Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <DOF2>
- #include <Pawn.CMD> // Usei pawn.cmd porque não tinha zcmd aqui, mas é só trocar pra zcmd que funciona perfeitamente.
- #include <streamer>
- #include <sscanf2>
- #define function%0(%1) forward %0(%1); public %0(%1);
- #define COLOR_RED 0xFF0000FF
- #define PASTA_ROUBOS "Roubos/%s"
- enum pInfo
- {
- Ladrao,
- Roubou,
- Procurado
- };
- new PlayerInfo[MAX_PLAYERS][pInfo];
- forward RoubandoCaixa(playerid);
- new Str[128];
- public OnGameModeInit()
- {
- //=-=-=-=-=-=-=-=-= Caixas =-=-=-=-=-=-=-=-=//
- CreateObject(2942, 2941.12231, -1023.85358, 11.41078, 0.00000, 0.00000, 86.46001);//1
- CreateObject(2942, 2941.15088, -1025.81519, 11.41078, 0.00000, 0.00000, 86.46001);//2
- CreateObject(2942, 2941.20190, -1021.55511, 11.41078, 0.00000, 0.00000, 86.46001);//3
- //=-=-=-=-=-=-=-=-= 3D =-=-=-=-=-=-=-=-=//
- Create3DTextLabel("Caixa 1'\n use:/roubar",0x5EAF03FF,2941.8210,-1025.9080,11.8258,10.0,0);//caixa1
- Create3DTextLabel("Caixa 2'\n use:/roubar",0x5EAF03FF,2941.7786,-1023.9998,11.8258,10.0,0);//caixa2
- Create3DTextLabel("Caixa 3'\n use:/roubar",0x5EAF03FF,2941.8572,-1021.6834,11.8258,10.0,0);//caixa3
- //=-=-=-=-=-=-=-=-= Pickup =-=-=-=-=-=-=-=-=//
- CreatePickup(1274, 1, 2941.8210,-1025.9080,11.8258,0);//caixa1
- CreatePickup(1274, 1, 2941.7786,-1023.9998,11.8258,0);//caixa2
- CreatePickup(1274, 1, 2941.8572,-1021.6834,11.8258,0);//caixa3
- return 1;
- }
- public OnGameModeExit()
- {
- DOF2_Exit();
- for(new playerid = 0; playerid < MAX_PLAYERS; playerid++) {
- if(IsPlayerConnected(playerid)) SaveIni(playerid);
- }
- return 1;
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- SetSpawnInfo(playerid, 0, 0, 1154.0398,-1771.1340,16.5992,2.6546, 0, 0, 0, 0, 0, 0);
- SpawnPlayer(playerid);
- return 1;
- }
- main()
- {
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- return 0;
- }
- public OnPlayerConnect(playerid)
- {
- LoadInfo(playerid);
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- new arquivo[128];
- format(arquivo, sizeof(arquivo), "Roubos/%s", GetPlayerNameEx(playerid));
- if(!DOF2_FileExists(arquivo)) return 1;
- DOF2_CreateFile(arquivo);
- SaveIni(playerid);
- return 1;
- }
- CMD:roubar(playerid)
- {
- if(IsPlayerInRangeOfPoint(playerid, 2.0, 2941.8210,-1025.9080,11.8258) || IsPlayerInRangeOfPoint(playerid, 2.0, 2941.7786,-1023.9998,11.8258) || IsPlayerInRangeOfPoint(playerid, 2.0, 2941.8572,-1021.6834,11.8258)) {
- SetTimerEx("RoubandoCaixa", 5000, false, "d", playerid);
- GameTextForPlayer(playerid, "Roubando!", 10000, 5);
- TogglePlayerControllable(playerid, 0);
- format(Str, sizeof(Str), "[ INFO ] O Player[%s][%d] Esta Roubando o banco central!", GetPlayerNameEx(playerid), playerid);
- SendClientMessageToAll(-1, Str), PlayerInfo[playerid][Roubou] = 1;
- SendClientMessage(playerid, COLOR_RED, "[ BANCO ] A polícia foi alertada."), SetPlayerWantedLevel(playerid, 5), PlayerInfo[playerid][Procurado] = 1;
- } else {
- SendClientMessage(playerid, COLOR_RED, "Você não está perto de um caixa para assalta-lo!");
- }
- return 1;
- }
- forward RoubandoCaixa(playerid);
- public RoubandoCaixa(playerid)
- {
- format(Str, sizeof(Str), "[ INFO ] O Player[%s][%d] Conseguiu Roubar o Banco Central", GetPlayerNameEx(playerid), playerid);
- SendClientMessageToAll(-1, Str);
- GivePlayerMoney(playerid, 10000);
- TogglePlayerControllable(playerid, 1);
- return 1;
- }
- stock SaveIni(playerid)
- {
- new arquivo[128];
- format(arquivo, sizeof(arquivo), PASTA_ROUBOS, GetPlayerNameEx(playerid));
- DOF2_SetInt(arquivo, "Ladrao", PlayerInfo[playerid][Ladrao]);
- DOF2_SetInt(arquivo, "Roubou", PlayerInfo[playerid][Roubou]);
- DOF2_SetInt(arquivo, "Procurados", PlayerInfo[playerid][Procurado]);
- return 1;
- }
- stock LoadInfo(playerid)
- {
- new arquivo[128];
- format(arquivo, sizeof(arquivo), PASTA_ROUBOS, GetPlayerNameEx(playerid));
- DOF2_SetInt(arquivo, "Ladrao", PlayerInfo[playerid][Ladrao]);
- DOF2_SetInt(arquivo, "Roubou", PlayerInfo[playerid][Roubou]);
- PlayerInfo[playerid][Ladrao] = DOF2_GetInt(arquivo, "Ladrao");
- PlayerInfo[playerid][Roubou] = DOF2_GetInt(arquivo, "Roubou");
- PlayerInfo[playerid][Procurado] = DOF2_GetInt(arquivo, "Procurados");
- if(PlayerInfo[playerid][Procurado] > 0)
- {
- SetPlayerWantedLevel(playerid, 5);
- } else {
- SetPlayerWantedLevel(playerid, 0);
- }
- return 1;
- }
- stock GetPlayerNameEx(playerid)
- {
- static pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
- return pName;
- }
Advertisement
Add Comment
Please, Sign In to add comment