Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- VISITE NOSSO SITE: http://www.sampknd.com/
- VISITE NOSSO FACEBOOK: http://www.facebook.com/SampKnd
- SAMP KND MELHOR BLOG DE SAMP DO BRASIL
- Comandos:
- faction "criar e apagar [id]";
- darlider;
- lider "convidar [id], demitir [id], promover [id], rebaixar [id], info";
- ingressar;
- radio;
- membros;
- lideres;
- editarfaccao "cargo, nome";
- factions;
- entrar;
- sair;
- sethq;
- editarhq "mover";
- .
- salvamento add
- */
- #include < a_samp >
- #include < zcmd >
- #include < sscanf2 >
- #include < streamer >
- #include < dof2 >
- #define cor_erro 0xFF5959AA
- #define cor_sucesso 0x05A529AA
- #define max_faction 50
- #define max_HQ 50
- #define max_players MAX_PLAYERS
- #define local_h "Faction/HQ/%d.ini"
- #define local_f "Faction/Factions/%d.ini"
- #define local_p "Faction/Player/%s.ini"
- #define erro_admin "erro: você não possue cargo administrativo."
- #define erro_id "erro: jogador não conectado."
- #define erro_faction "erro: você não é dessa facção."
- #define erro_lider "erro: você não é um lider."
- #define nome_da_faccao "faction_%d" //nomes gerados inicialmente.
- #define f_cargo_1 "Cargo 1"
- #define f_cargo_2 "Cargo 2"
- #define f_cargo_3 "Cargo 3"
- #define f_cargo_4 "Cargo 4"
- #define f_cargo_5 "Cargo 5"
- #define f_cargo_6 "Lider"
- enum enum_faction
- {
- Ativo,
- Banco,
- Nome[32],
- Cargo_1[32],
- Cargo_2[32],
- Cargo_3[32],
- Cargo_4[32],
- Cargo_5[32],
- Cargo_6[32],
- HeadQ
- }
- enum enum_player
- {
- owner,
- pfaction,
- pcargo
- }
- enum enum_convidado
- {
- cativo,
- cfaction
- }
- enum enum_HQ
- {
- ativo,
- tipo,
- factionid,
- Float:x,
- Float:y,
- Float:z,
- Float:intx,
- Float:inty,
- Float:intz,
- Interior,
- World,
- Pickup[2],
- Text3D:Label[2]
- }
- new faction[max_faction][enum_faction];
- new player[max_players][enum_player];
- new convidado[max_players][enum_convidado];
- new HQ[max_HQ][enum_HQ];
- new bool:InHQ = false;
- public OnGameModeInit()
- {
- LoadFaction();
- LoadHQ();
- CreateInt();
- return 1;
- }
- public OnGameModeExit()
- {
- DOF2_Exit();
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- LoadPlayer(playerid);
- return 1;
- }
- public OnPlayerDisconnect(playerid)
- {
- SavePlayer(playerid);
- return 1;
- }
- command(membros, playerid, params[])
- {
- if(player[playerid][pfaction] == 0) return SendClientMessage(playerid, cor_erro, "erro: você não está em nenhuma facção!");
- new _string[128], faction_id = player[playerid][pfaction];
- SendClientMessage(playerid, cor_sucesso, "Membros online:");
- for(new i = 0; i < max_players; i++)
- {
- if(player[i][pfaction] == faction_id)
- {
- format(_string, sizeof(_string), "%s (ID: %d) Cargo: %s (%d)", GetName(i), i, GetRankName(i), player[playerid][pcargo]);
- SendClientMessage(playerid, cor_sucesso, _string);
- }
- }
- return 1;
- }
- command(lideres, playerid, params[])
- {
- new faction_id, _string[128];
- SendClientMessage(playerid, cor_sucesso, "Lideres online:");
- for(new i = 0; i < max_players; i++)
- {
- if(player[i][pcargo] == 6)
- {
- faction_id = player[i][pfaction];
- format(_string, sizeof(_string), "%s (ID: %d) Facção: %s", GetName(i), i, GetFactionName(faction_id));
- SendClientMessage(playerid, cor_sucesso, _string);
- }
- }
- return 1;
- }
- command(faccoes, playerid, params[])
- {
- new _string[128];
- SendClientMessage(playerid, cor_sucesso, "Facçoes:");
- for(new i = 0; i < max_players; i++)
- {
- if(faction[i][Ativo] == 0) continue;
- format(_string, 128, "Nome: %s ID:", GetFactionName(i), i);
- SendClientMessage(playerid, cor_sucesso, _string);
- }
- return 1;
- }
- command(faccao, playerid, params [])
- {
- new _string[128], subcmd[32], id;
- if(sscanf(params, "s[32]I(-1)", subcmd, id))
- {
- SendClientMessage(playerid, cor_sucesso, "[opcoes]");
- SendClientMessage(playerid, cor_erro, "[subcomandos] criar");
- SendClientMessage(playerid, cor_erro, "[subcomandos] apagar [id]");
- return 1;
- }
- if(!strcmp(subcmd, "criar", true))
- {
- if(!IsPlayerAdmin(playerid)) return 1;
- new Y; Y = max_faction+1;
- for(new X = 0; X < max_faction; X++)
- {
- if(X == 0) continue;
- if(faction[X][Ativo] == 1) continue;
- Y = X;
- break;
- }
- if(Y > max_faction) return SendClientMessage(playerid, cor_erro, "erro: o maximo de facções foi atingido.");
- faction[Y][Ativo] = 1;
- faction[Y][Banco] = 50000;
- format(faction[Y][Nome], 32, nome_da_faccao, Y);
- format(faction[Y][Cargo_1], 32, f_cargo_1);
- format(faction[Y][Cargo_2], 32, f_cargo_2);
- format(faction[Y][Cargo_3], 32, f_cargo_3);
- format(faction[Y][Cargo_4], 32, f_cargo_4);
- format(faction[Y][Cargo_5], 32, f_cargo_5);
- format(faction[Y][Cargo_6], 32, f_cargo_6);
- format(_string, 128, "admin: Você acaba de criar uma facção (id: %d, nome:%s).",Y, GetFactionName(Y));
- SendClientMessage(playerid, cor_sucesso, _string);
- SendClientMessage(playerid, cor_sucesso, "admin: Para você setar essa facção a um jogador use /darlider [id do jogador].");
- SendClientMessage(playerid, cor_sucesso, "admin: Para você setar uma HQ para essa facção use /sethq [factionid] [tipo].");//v2
- new Local[128];
- format(Local, 128, local_f, Y);
- DOF2_CreateFile(Local);
- DOF2_SetInt(Local, "ativo", 1);
- DOF2_SetInt(Local, "banco", faction[Y][Banco]);
- DOF2_SetString(Local, "Nome", faction[Y][Nome]);
- DOF2_SetString(Local, "Cargo_1", faction[Y][Cargo_1]);
- DOF2_SetString(Local, "Cargo_2", faction[Y][Cargo_2]);
- DOF2_SetString(Local, "Cargo_3", faction[Y][Cargo_3]);
- DOF2_SetString(Local, "Cargo_4", faction[Y][Cargo_4]);
- DOF2_SetString(Local, "Cargo_5", faction[Y][Cargo_5]);
- DOF2_SetString(Local, "Cargo_6", faction[Y][Cargo_6]);
- DOF2_SaveFile();
- return 1;
- }
- if(!strcmp(subcmd, "apagar", true))
- {
- faction[id][Ativo] = 0;
- faction[id][Banco] = 0;
- faction[id][Nome] = 0;
- faction[id][Cargo_1] = 0;
- faction[id][Cargo_2] = 0;
- faction[id][Cargo_3] = 0;
- faction[id][Cargo_4] = 0;
- faction[id][Cargo_5] = 0;
- faction[id][Cargo_6] = 0;
- format(_string, 128, local_f, id);
- DOF2_RemoveFile(_string);
- format(_string, 128, "admin: você apagou a facção %d.");
- SendClientMessage(playerid, cor_sucesso, _string);
- return 1;
- }
- return 1;
- }
- command(darlider, playerid, params [])
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, cor_erro, erro_admin);
- new _string[128], jogador, faction_id;
- if(sscanf(params, "ud", jogador, faction_id)) return SendClientMessage(playerid, cor_erro, "comando: darlider [id/nome] [factionid].");
- if(!IsPlayerConnected(jogador)) return SendClientMessage(playerid, cor_erro, erro_id);
- if(player[jogador][pfaction] > 0) return SendClientMessage(playerid, cor_erro, erro_faction);
- if(player[jogador][pcargo] == 6) return SendClientMessage(playerid, cor_erro, "erro: esse jogador ja é um lider.");
- player[jogador][pfaction] = faction_id;
- player[jogador][pcargo] = 6;
- format(_string, 128, "faction: %s (%d) recebeu um lider.", GetFactionName(faction_id), faction_id);
- SendClientMessageToAll(cor_sucesso, _string);
- SendClientMessageToAll(cor_sucesso, "faction: Veja o novo lider em /lideres.");
- return 1;
- }
- command(lider, playerid, params [])
- {
- new _string[128];
- new subcmd[32], id;
- if(player[playerid][pcargo] < 6) return SendClientMessage(playerid, cor_erro, "faction: cargo insuficiente para completar a tarefa.");
- if(sscanf(params, "s[32]I(-1)", subcmd, id))
- {
- SendClientMessage(playerid, cor_erro, "________________________[Oções]________________________");
- SendClientMessage(playerid, cor_erro, "[subcomandos] convidar [id], promover [id], rebaixar [id]");
- SendClientMessage(playerid, cor_erro, "[subcomandos] demitir [id], info (exibe informações para os membros)");
- SendClientMessage(playerid, cor_erro, "[outros] você ainda pode fazer outras alterações como os nomes dos cargos e o da facção;");
- SendClientMessage(playerid, cor_erro, "[outros] para que você possa fazer ediçoes use /editarfaccao.");
- return 1;
- }
- if(!strcmp(subcmd, "convidar", true))
- {
- if(id == -1)
- {
- SendClientMessage(playerid, cor_erro, "________________________[Oções]________________________");
- SendClientMessage(playerid, cor_erro, "[subcomandos] convidar [id], promover [id], rebaixar [id]");
- SendClientMessage(playerid, cor_erro, "[subcomandos] demitir [id], info (exibe informações para os membros)");
- SendClientMessage(playerid, cor_erro, "[outros] você ainda pode fazer outras alterações como os nomes dos cargos e o da facção;");
- SendClientMessage(playerid, cor_erro, "[outros] para que você possa fazer ediçoes use /editarfaccao.");
- return 1;
- }
- if(!IsPlayerConnected(id)) return 1;
- if(player[playerid][pfaction] != player[id][pfaction]) return 1;
- new fac = player[playerid][pfaction];
- convidado[id][cativo] = 1;
- convidado[id][cfaction] = player[playerid][pfaction];
- format(_string, 128, "Você enviou um convite de sua facção para %s.", GetName(id));
- SendClientMessage(playerid, -1, _string);
- format(_string, 128, "Você foi convidado para participar da facção %s por %s.", GetFactionName(fac), GetName(playerid));
- SendClientMessage(playerid, -1, _string);
- return 1;
- }
- if(!strcmp(subcmd, "demitir", true))
- {
- if(id == -1)
- {
- SendClientMessage(playerid, cor_erro, "________________________[Oções]________________________");
- SendClientMessage(playerid, cor_erro, "[subcomandos] convidar [id], promover [id], rebaixar [id]");
- SendClientMessage(playerid, cor_erro, "[subcomandos] demitir [id], info (exibe informações para os membros)");
- SendClientMessage(playerid, cor_erro, "[outros] você ainda pode fazer outras alterações como os nomes dos cargos e o da facção;");
- SendClientMessage(playerid, cor_erro, "[outros] para que você possa fazer ediçoes use /editarfaccao.");
- return 1;
- }
- if(!IsPlayerConnected(id)) return 1;
- if(player[playerid][pfaction] != player[id][pfaction]) return 1;
- format(_string, 128, "O membro %s foi demitido.", GetName(id));
- SendFactionMessage(player[id][pfaction], cor_erro, _string);
- player[id][pfaction] = 0;
- player[id][pcargo] = 0;
- return 1;
- }
- if(!strcmp(subcmd, "promover", true))
- {
- if(id == -1)
- {
- SendClientMessage(playerid, cor_erro, "________________________[Oções]________________________");
- SendClientMessage(playerid, cor_erro, "[subcomandos] convidar [id], promover [id], rebaixar [id]");
- SendClientMessage(playerid, cor_erro, "[subcomandos] demitir [id], info (exibe informações para os membros)");
- SendClientMessage(playerid, cor_erro, "[outros] você ainda pode fazer outras alterações como os nomes dos cargos e o da facção;");
- SendClientMessage(playerid, cor_erro, "[outros] para que você possa fazer ediçoes use /editarfaccao.");
- return 1;
- }
- if(!IsPlayerConnected(id)) return 1;
- if(player[playerid][pfaction] != player[id][pfaction]) return 1;
- if(player[id][pcargo] == 6) return SendClientMessage(playerid, -1, "Esse membro ja possue o cargo maximo.");
- format(_string, 128, "O membro %s foi promovido.", GetName(id));
- SendFactionMessage(player[id][pfaction], -1, _string);
- format(_string, 128, "Cargo: %d.", player[id][pcargo]);
- SendFactionMessage(player[id][pfaction], -1, _string);
- player[id][pcargo]++;
- return 1;
- }
- if(!strcmp(subcmd, "rebaixar", true))
- {
- if(id == -1)
- {
- SendClientMessage(playerid, cor_erro, "________________________[Oções]________________________");
- SendClientMessage(playerid, cor_erro, "[subcomandos] convidar [id], promover [id], rebaixar [id]");
- SendClientMessage(playerid, cor_erro, "[subcomandos] demitir [id], info (exibe informações para os membros)");
- SendClientMessage(playerid, cor_erro, "[outros] você ainda pode fazer outras alterações como os nomes dos cargos e o da facção;");
- SendClientMessage(playerid, cor_erro, "[outros] para que você possa fazer ediçoes use /editarfaccao.");
- return 1;
- }
- if(!IsPlayerConnected(id)) return 1;
- if(player[playerid][pfaction] != player[id][pfaction]) return 1;
- if(player[id][pcargo] == 1) return SendClientMessage(playerid, cor_erro, "Esse membro ja possue o menor cargo use /lider demitir [id].");
- format(_string, 128, "O membro %s foi rebaixado.", GetName(id));
- SendFactionMessage(player[id][pfaction], cor_erro, _string);
- format(_string, 128, "Cargo: %d." ,player[id][pcargo]--);
- SendFactionMessage(player[id][pfaction], -1, _string);
- player[id][pcargo]--;
- return 1;
- }
- if(!strcmp(subcmd, "info", true))
- {
- new minhafac = player[playerid][pfaction];
- format(_string, 128, "Nome da facção: %s", GetFactionName(minhafac));
- SendClientMessage(playerid, cor_sucesso, _string);//
- // format(_string, 128, "Tipo da facção: %d", faction[minhafac][Tipo]); V2.0
- // SendClientMessage(playerid, cor_sucesso, _string);
- format(_string, 128, "Cofre da facção: %d", faction[minhafac][Banco]);
- SendClientMessage(playerid, cor_sucesso, _string);//
- format(_string, 128, "Cargo 1: %s", faction[minhafac][Cargo_1]);
- SendClientMessage(playerid, cor_sucesso, _string);//
- format(_string, 128, "Cargo 2: %s", faction[minhafac][Cargo_2]);
- SendClientMessage(playerid, cor_sucesso, _string);//
- format(_string, 128, "Cargo 3: %s", faction[minhafac][Cargo_3]);
- SendClientMessage(playerid, cor_sucesso, _string);//
- format(_string, 128, "Cargo 4: %s", faction[minhafac][Cargo_4]);
- SendClientMessage(playerid, cor_sucesso, _string);//
- format(_string, 128, "Cargo 5: %s", faction[minhafac][Cargo_5]);
- SendClientMessage(playerid, cor_sucesso, _string);//
- format(_string, 128, "Cargo 6: %s", faction[minhafac][Cargo_6]);
- SendClientMessage(playerid, cor_sucesso, _string);//
- }
- return 1;
- }
- command(editarfaccao, playerid, params [])
- {
- new _string[128], subcmd[32], id, nome[32];
- new faction_id = player[playerid][pfaction];
- if(player[playerid][pcargo] < 6) return SendClientMessage(playerid, cor_erro, "faction: cargo insuficiente para completar a tarefa.");
- if(sscanf(params, "s[32]sI(-1)", subcmd, nome, id))
- {
- SendClientMessage(playerid, cor_erro, "________________________[Oções]________________________");
- SendClientMessage(playerid, cor_erro, "[subcomandos] cargo [nome] [cargo 1-6].");
- SendClientMessage(playerid, cor_erro, "[subcomandos] nome [nome].");
- SendClientMessage(playerid, cor_erro, "[exemplo] /editarfaccao cargo Insider 1 (seta o nome insider para o cargo 1).");
- SendClientMessage(playerid, cor_erro, "[exemplo] /editarfaccao nome Riffas. (seta o nome Riffas para a facção).");
- SendClientMessage(playerid, cor_erro, "[aviso] caso voce use espaços no nome da facção como Los Vagos, no lugar de espaço use ( _ ).");
- SendClientMessage(playerid, cor_erro, "[exemplo]/editarfaccao Los_Vagos (o simbolo _ não aparecera).");
- SendClientMessage(playerid, cor_erro, "[aviso] use no maximo 32 caracteres.");
- return 1;
- }
- if(!strcmp(subcmd, "cargo", true))
- {
- if(id == -1)
- {
- SendClientMessage(playerid, cor_erro, "________________________[Oções]________________________");
- SendClientMessage(playerid, cor_erro, "[subcomandos] cargo [cargo].");
- SendClientMessage(playerid, cor_erro, "[subcomandos] nome [nome].");
- SendClientMessage(playerid, cor_erro, "[aviso] use no maximo 32 caracteres.");
- }
- format(_string, sizeof(_string), local_f, faction_id);
- switch(id)
- {
- case 1:
- format(faction[faction_id][Cargo_1], 32, "%s", nome),
- DOF2_SetString(_string, "Cargo_1", faction[faction_id][Cargo_1]),
- DOF2_SaveFile();
- case 2:
- format(faction[faction_id][Cargo_2], 32, "%s", nome),
- DOF2_SetString(_string, "Cargo_2", faction[faction_id][Cargo_2]),
- DOF2_SaveFile();
- case 3:
- format(faction[faction_id][Cargo_3], 32, "%s", nome),
- DOF2_SetString(_string, "Cargo_3", faction[faction_id][Cargo_3]),
- DOF2_SaveFile();
- case 4:
- format(faction[faction_id][Cargo_4], 32, "%s", nome),
- DOF2_SetString(_string, "Cargo_4", faction[faction_id][Cargo_4]),
- DOF2_SaveFile();
- case 5:
- format(faction[faction_id][Cargo_5], 32, "%s", nome),
- DOF2_SetString(_string, "Cargo_5", faction[faction_id][Cargo_5]),
- DOF2_SaveFile();
- case 6:
- format(faction[faction_id][Cargo_6], 32, "%s", nome),
- DOF2_SetString(_string, "Cargo_6", faction[faction_id][Cargo_6]),
- DOF2_SaveFile();
- case 7 .. 999: return SendClientMessage(playerid, cor_erro, "faction: cargos de 1 a 6.");
- }
- format(_string, 128, "faction: você alterou o cargo: %d para: %s.", id, nome);
- SendClientMessage(playerid, cor_sucesso, _string);
- return 1;
- }
- if(!strcmp(subcmd, "nome", true))
- {
- new HeadID;
- format(faction[faction_id][Nome], 32, "%s", nome);
- format(_string, 128, "faction: você alterou o nome da faccao para: %s.", nome);
- SendClientMessage(playerid, cor_sucesso, _string);
- format(_string, sizeof(_string), local_f, faction_id);
- DOF2_SetString(_string, "Nome", faction[faction_id][Nome]);
- DOF2_SaveFile();
- Delete3DTextLabel(HQ[HeadID][Label][0]);
- Delete3DTextLabel(HQ[HeadID][Label][1]);
- HeadID = faction[faction_id][HeadQ];
- format(_string, 128, "Faction: %s\nID: %d\nEntrada", GetFactionName(HQ[HeadID][factionid]), HeadID);
- HQ[HeadID][Label][0] = Create3DTextLabel(_string, -1, HQ[HeadID][x], HQ[HeadID][y], HQ[HeadID][z]-0.2, 5.0, 0);
- format(_string, 128, "Faction: %s\nID: %d\nSaida", GetFactionName(HQ[HeadID][factionid]), HeadID);
- HQ[HeadID][Label][1] = Create3DTextLabel(_string, -1, HQ[HeadID][intx], HQ[HeadID][inty], HQ[HeadID][intz]-0.2, 5.0, HQ[HeadID][World]);
- return 1;
- }
- return 1;
- }
- command(editarhq, playerid, params [])
- {
- if(InHQ == true) return 1;
- new faction_id, hq_id, subcmd[32], _string[128];
- if(player[playerid][pcargo] < 6) return SendClientMessage(playerid, cor_erro, "faction: cargo insuficiente para completar a tarefa.");
- if(sscanf(params, "s[32]", subcmd))
- {
- SendClientMessage(playerid, cor_erro, "[opcoes]");
- SendClientMessage(playerid, cor_erro, "[subcomandos] mover.");
- SendClientMessage(playerid, cor_sucesso, "[aviso] ao digitar '/editarhq mover' a entrada do HQ sera posta em sua posição.");
- return 1;
- }
- if(!strcmp(subcmd, "nome", true))
- {
- new Float:mX, Float:mY, Float:mZ;
- GetPlayerPos(playerid, mX, mY, mZ);
- faction_id = player[playerid][pfaction];
- hq_id = faction[faction_id][HeadQ];
- HQ[hq_id][x] = mX, HQ[hq_id][x] = mY, HQ[hq_id][x] = mZ;
- new Local[128];
- format(Local, 128, local_h, hq_id);
- DOF2_SetFloat(Local, "x", HQ[hq_id][x]);
- DOF2_SetFloat(Local, "y", HQ[hq_id][y]);
- DOF2_SetFloat(Local, "z", HQ[hq_id][z]);
- DOF2_SaveFile();
- Delete3DTextLabel(HQ[hq_id][Label][0]);
- Delete3DTextLabel(HQ[hq_id][Label][1]);
- DestroyPickup(HQ[hq_id][Pickup][0]);
- DestroyPickup(HQ[hq_id][Pickup][1]);
- HQ[hq_id][Pickup][0] = CreatePickup(19198, 1, HQ[hq_id][x], HQ[hq_id][y], HQ[hq_id][z]+0.2, 0);
- HQ[hq_id][Pickup][1] = CreatePickup(19198, 1, HQ[hq_id][intx], HQ[hq_id][inty], HQ[hq_id][intz]+0.2, HQ[hq_id][World]);
- format(_string, 128, "Faction: %s\nID: %d\nEntrada", GetFactionName(HQ[hq_id][factionid]), hq_id);
- HQ[hq_id][Label][0] = Create3DTextLabel(_string, -1, HQ[hq_id][x], HQ[hq_id][y], HQ[hq_id][z]-0.2, 5.0, 0);
- format(_string, 128, "Faction: %s\nID: %d\nSaida", GetFactionName(HQ[hq_id][factionid]), hq_id);
- HQ[hq_id][Label][1] = Create3DTextLabel(_string, -1, HQ[hq_id][intx], HQ[hq_id][inty], HQ[hq_id][intz]-0.2, 5.0, HQ[hq_id][World]);
- return 1;
- }
- return 1;
- }
- command(radio, playerid, params [])
- {
- new texto[200], _string[200];
- if(sscanf(params, "s", texto)) return SendClientMessage(playerid, cor_erro, "erro: comando: /radio [texto]");
- if(player[playerid][pfaction] == 0) return SendClientMessage(playerid, cor_erro, "erro: você não possue uma facção.");
- format(_string, 200, "R: %s: %s: %s.", GetRankName(playerid), GetName(playerid), texto);
- SendFactionMessage(player[playerid][pfaction], -1, _string);
- return 1;
- }
- command(ingressar, playerid, params [])
- {
- new _string[128];
- if(convidado[playerid][cativo] == 0) return SendClientMessage(playerid, -1, "Você ainda não foi convidado por nenhuma facção");
- player[playerid][pfaction] = convidado[playerid][cfaction];
- player[playerid][pcargo] = 1;
- SendClientMessage(playerid, -1, "Bem vindo, tenha um bom jogo.");
- format(_string, 128, "O jogador %s se juntou a facção.", GetName(playerid));
- SendFactionMessage(player[playerid][pfaction], -1, _string);
- convidado[playerid][cativo] = 0;
- convidado[playerid][cfaction] = 0;
- return 1;
- }
- //hq
- command(sethq, playerid, params [])
- {
- new Local[128];
- new a = max_HQ+1, _string[128];
- new Float:mX, Float:mY, Float:mZ, _factionid, interior;
- if(sscanf(params, "d", _factionid/*, interior*/)) return SendClientMessage(playerid, -1, "comando: sethq: [factionid]");
- for(new i = 0; i < max_HQ; i++)
- {
- if(i == 0) continue;
- if(HQ[i][ativo] == 1) continue;
- a = i;
- }
- if(a > max_HQ) return 1;
- GetPlayerPos(playerid, mX, mY, mZ);
- HQ[a][ativo] = 1;
- HQ[a][tipo] = interior;
- HQ[a][factionid] = _factionid;
- HQ[a][x] = mX;
- HQ[a][y] = mY;
- HQ[a][z] = mZ;
- HQ[a][Interior] = 0;
- HQ[a][World] = a;
- faction[_factionid][HeadQ] = a;
- switch(interior)
- {
- case 1:
- HQ[a][intx] = 1901.4934, HQ[a][inty] = -1853.3789, HQ[a][intz] = 1501.5160;
- case 2:
- HQ[a][intx] = 1901.4934, HQ[a][inty] = -1853.3789, HQ[a][intz] = 1501.5160;
- }
- HQ[a][Pickup][0] = CreatePickup(19198, 1, HQ[a][x], HQ[a][y], HQ[a][z]+0.2, 0);
- HQ[a][Pickup][1] = CreatePickup(19198, 1, HQ[a][intx], HQ[a][inty], HQ[a][intz]+0.2, HQ[a][World]);
- format(_string, 128, "Faction: %s\nID: %d\nEntrada", GetFactionName(HQ[a][factionid]), a);
- HQ[a][Label][0] = Create3DTextLabel(_string, -1, HQ[a][x], HQ[a][y], HQ[a][z]-0.2, 5.0, 0);
- format(_string, 128, "Faction: %s\nID: %d\nSaida", GetFactionName(HQ[a][factionid]), a);
- HQ[a][Label][1] = Create3DTextLabel(_string, -1, HQ[a][intx], HQ[a][inty], HQ[a][intz]-0.2, 5.0, HQ[a][World]);
- format(Local, 128, local_h, a);
- DOF2_CreateFile(Local);
- DOF2_SetInt(Local, "ativo", 1);
- DOF2_SetInt(Local, "tipo", interior);
- DOF2_SetInt(Local, "factionid", _factionid);
- DOF2_SetFloat(Local, "x", HQ[a][x]);
- DOF2_SetFloat(Local, "y", HQ[a][y]);
- DOF2_SetFloat(Local, "z", HQ[a][z]);
- DOF2_SetFloat(Local, "intx", HQ[a][intx]);
- DOF2_SetFloat(Local, "inty", HQ[a][inty]);
- DOF2_SetFloat(Local, "intz", HQ[a][intz]);
- DOF2_SetInt(Local, "interior", interior);
- DOF2_SetInt(Local, "world", a);
- format(Local, 128, local_f, _factionid);
- DOF2_SetInt(Local, "HQ", a);
- DOF2_SaveFile();
- return 1;
- }
- command(entrar, playerid, params [])
- {
- new H = max_HQ+1;
- for(new a = 0; a < max_HQ; a++)
- {
- if(IsPlayerInRangeOfPoint(playerid, 1.0, HQ[a][x], HQ[a][y], HQ[a][z]))
- {
- H = a;
- break;
- }
- }
- if(H > max_HQ) return 1;
- if(player[playerid][pfaction] != HQ[H][factionid]) return SendClientMessage(playerid, cor_erro, "faction: você não é dessa facção.");
- SetPlayerInterior(playerid, HQ[H][Interior]);
- SetPlayerVirtualWorld(playerid, HQ[H][World]);
- SetPlayerPos(playerid, HQ[H][intx], HQ[H][inty], HQ[H][intz]+0.1);
- InHQ = true;
- return 1;
- }
- CMD:sair(playerid)
- {
- for(new i = 0; i < max_HQ; i++)
- {
- if(IsPlayerInRangeOfPoint(playerid, 2.0, HQ[i][intx], HQ[i][inty], HQ[i][intz]))
- {
- if(GetPlayerVirtualWorld(playerid) == HQ[i][World])
- {
- SetPlayerPos(playerid, HQ[i][x], HQ[i][y], HQ[i][z]);
- SetPlayerInterior(playerid, 0);
- SetPlayerVirtualWorld(playerid, 0);
- InHQ = false;
- }
- }
- }
- return 1;
- }
- stock GetFactionName(fac)
- {
- new fnome[32];
- format(fnome, 32, "%s", faction[fac][Nome]);
- for(new i = 0; i < 32; i++)
- {
- if(fnome[i] == '_') fnome[i] = ' ';
- }
- return fnome;
- }
- stock GetName(playerid)
- {
- new nome[MAX_PLAYER_NAME];
- GetPlayerName(playerid, nome, sizeof(nome));
- for(new i = 0; i < MAX_PLAYER_NAME; i++)
- {
- if(nome[i] == '_') nome[i] = ' ';
- }
- return nome;
- }
- stock SendFactionMessage(fac, color, message [])
- {
- for(new i = 0; i < max_players; i++)
- {
- if(player[i][pfaction] == fac)
- {
- SendClientMessage(i, color, message);
- }
- }
- return 1;
- }
- stock GetRankName(playerid)
- {
- new _string[32];
- new faction_id = player[playerid][pfaction];
- if(player[playerid][pcargo] == 1)
- {
- format(_string, 32, faction[faction_id][Cargo_1]);
- }
- if(player[playerid][pcargo] == 2)
- {
- format(_string, 32, faction[faction_id][Cargo_2]);
- }
- if(player[playerid][pcargo] == 3)
- {
- format(_string, 32, faction[faction_id][Cargo_3]);
- }
- if(player[playerid][pcargo] == 4)
- {
- format(_string, 32, faction[faction_id][Cargo_4]);
- }
- if(player[playerid][pcargo] == 5)
- {
- format(_string, 32, faction[faction_id][Cargo_5]);
- }
- if(player[playerid][pcargo] == 6)
- {
- format(_string, 32, faction[faction_id][Cargo_6]);
- }
- return _string;
- }
- stock LoadFaction()
- {
- new Local[128];
- for(new i; i < max_faction; i++)
- {
- format(Local, sizeof(Local), local_f, i);
- if(DOF2_FileExists(Local))
- {
- faction[i][Ativo] = DOF2_GetInt(Local, "ativo");
- faction[i][Banco] = DOF2_GetInt(Local, "banco");
- format(faction[i][Nome], 32, DOF2_GetString(Local, "Nome"));
- format(faction[i][Cargo_1], 32, DOF2_GetString(Local, "Cargo_1"));
- format(faction[i][Cargo_2], 32, DOF2_GetString(Local, "Cargo_2"));
- format(faction[i][Cargo_3], 32, DOF2_GetString(Local, "Cargo_3"));
- format(faction[i][Cargo_4], 32, DOF2_GetString(Local, "Cargo_4"));
- format(faction[i][Cargo_5], 32, DOF2_GetString(Local, "Cargo_5"));
- format(faction[i][Cargo_6], 32, DOF2_GetString(Local, "Cargo_6"));
- }
- }
- return 1;
- }
- stock LoadHQ()
- {
- new Local[128], _string[128];
- for(new i; i < max_HQ; i++)
- {
- format(Local, sizeof(Local), local_h, i);
- if(DOF2_FileExists(Local))
- {
- HQ[i][ativo] = DOF2_GetInt(Local, "ativo");
- HQ[i][factionid] = DOF2_GetInt(Local, "factionid");
- HQ[i][x] = DOF2_GetFloat(Local, "x");
- HQ[i][y] = DOF2_GetFloat(Local, "y");
- HQ[i][z] = DOF2_GetFloat(Local, "z");
- HQ[i][intx] = DOF2_GetFloat(Local, "intx");
- HQ[i][inty] = DOF2_GetFloat(Local, "inty");
- HQ[i][intz] = DOF2_GetFloat(Local, "intz");
- HQ[i][Interior] = DOF2_GetInt(Local, "interior");
- HQ[i][World] = DOF2_GetInt(Local, "world");
- HQ[i][Pickup][0] = CreatePickup(19198, 1, HQ[i][x], HQ[i][y], HQ[i][z]+0.2, 0);
- HQ[i][Pickup][1] = CreatePickup(19198, 1, HQ[i][intx], HQ[i][inty], HQ[i][intz]+0.2, HQ[i][World]);
- format(_string, 128, "Faction: %s\nID: %d\nEntrada", GetFactionName(HQ[i][factionid]), i);
- HQ[i][Label][0] = Create3DTextLabel(_string, -1, HQ[i][x], HQ[i][y], HQ[i][z]-0.2, 5.0, 0);
- format(_string, 128, "Faction: %s\nID: %d\nSaida", GetFactionName(HQ[i][factionid]), i);
- HQ[i][Label][1] = Create3DTextLabel(_string, -1, HQ[i][intx], HQ[i][inty], HQ[i][intz]-0.2, 5.0, HQ[i][World]);
- }
- }
- return 1;
- }
- stock LoadPlayer(playerid)
- {
- new Local[128];
- format(Local, sizeof(Local), local_p, GetName(playerid));
- if(DOF2_FileExists(Local))
- {
- player[playerid][pfaction] = DOF2_GetInt(Local, "pfaction");
- player[playerid][pcargo] = DOF2_GetInt(Local, "pcargo");
- convidado[playerid][cativo] = DOF2_GetInt(Local, "cativo");
- convidado[playerid][cfaction] = DOF2_GetInt(Local, "cfaction");
- }
- else
- {
- format(Local, sizeof(Local), local_p, GetName(playerid));
- DOF2_CreateFile(Local);
- DOF2_SetInt(Local, "pfaction", 0);
- DOF2_SetInt(Local, "pcargo", 0);
- DOF2_SetInt(Local, "cativo", 0);
- DOF2_SetInt(Local, "cfaction", 0);
- }
- return 1;
- }
- stock SavePlayer(playerid)
- {
- new Local[128];
- format(Local, sizeof(Local), local_p, GetName(playerid));
- DOF2_SetInt(Local, "pfaction", player[playerid][pfaction]);
- DOF2_SetInt(Local, "pcargo", player[playerid][pcargo]);
- DOF2_SetInt(Local, "cativo", convidado[playerid][cativo]);
- DOF2_SetInt(Local, "cfaction", convidado[playerid][cfaction]);
- DOF2_SaveFile();
- return 1;
- }
- stock CreateInt()
- {
- //int by: Killerbillty - [url]http://forum.sa-mp.com/member.php?u=201864;[/url]
- CreateDynamicObject(19448, 1896.77, -1850.19, 1500.43, 0.00, 90.00, 0.00);
- CreateDynamicObject(19448, 1896.77, -1859.82, 1500.43, 0.00, 90.00, 0.00);
- CreateDynamicObject(19448, 1900.27, -1850.19, 1500.43, 0.00, 90.00, 0.00);
- CreateDynamicObject(19448, 1900.27, -1859.82, 1500.43, 0.00, 90.00, 0.00);
- CreateDynamicObject(19463, 1895.11, -1850.19, 1502.26, 0.00, 0.00, 0.00);
- CreateDynamicObject(19463, 1899.85, -1847.34, 1502.26, 0.00, 0.00, 90.00);
- CreateDynamicObject(19463, 1901.93, -1850.19, 1502.26, 0.00, 0.00, 0.00);
- CreateDynamicObject(19371, 1901.93, -1856.61, 1502.26, 0.00, 0.00, 0.00);
- CreateDynamicObject(19463, 1893.95, -1854.92, 1502.26, 0.00, 0.00, 90.00);
- CreateDynamicObject(19398, 1898.68, -1856.61, 1502.26, 0.00, 0.00, 0.00);
- CreateDynamicObject(19398, 1900.32, -1858.12, 1502.26, 0.00, 0.00, 90.00);
- CreateDynamicObject(19395, 1898.66, -1856.60, 1502.26, 0.00, 0.00, 0.00);
- CreateDynamicObject(19367, 1896.98, -1854.93, 1502.26, 0.00, 0.00, 90.00);
- CreateDynamicObject(19367, 1896.98, -1858.12, 1502.26, 0.00, 0.00, 90.00);
- CreateDynamicObject(1491, 1898.68, -1857.34, 1500.50, 0.00, 0.00, 90.00);
- CreateDynamicObject(1491, 1899.53, -1858.14, 1500.50, 0.00, 0.00, 0.00);
- CreateDynamicObject(19367, 1895.32, -1856.60, 1502.26, 0.00, 0.00, 0.00);
- CreateDynamicObject(19397, 1900.31, -1858.14, 1502.26, 0.00, 0.00, 90.00);
- CreateDynamicObject(19461, 1893.89, -1858.14, 1502.26, 0.00, 0.00, 90.00);
- CreateDynamicObject(19461, 1895.11, -1863.04, 1502.26, 0.00, 0.00, 0.00);
- CreateDynamicObject(19461, 1901.93, -1863.04, 1502.26, 0.00, 0.00, 0.00);
- CreateDynamicObject(19459, 1898.06, -1864.54, 1502.26, 0.00, 0.00, 90.00);
- CreateDynamicObject(1535, 1901.91, -1854.16, 1500.49, 0.00, 0.00, 90.00);
- CreateDynamicObject(19380, 1900.25, -1850.22, 1503.94, 0.00, 90.00, 0.00);
- CreateDynamicObject(19380, 1900.25, -1859.85, 1503.94, 0.00, 90.00, 0.00);
- CreateDynamicObject(2074, 1898.91, -1851.15, 1503.62, 0.00, 0.00, 0.00);
- CreateDynamicObject(2074, 1898.61, -1861.30, 1503.62, 0.00, 0.00, 0.00);
- CreateDynamicObject(3034, 1895.20, -1860.85, 1502.49, 0.00, 0.00, 90.00);
- CreateDynamicObject(14384, 1898.65, -1851.03, 1502.01, 0.00, 0.00, 90.00);
- CreateDynamicObject(19426, 1895.24, -1853.05, 1501.52, 0.00, 90.00, 90.00);
- CreateDynamicObject(19426, 1895.24, -1848.49, 1501.52, 0.00, 90.00, 90.00);
- CreateDynamicObject(19426, 1896.96, -1847.49, 1501.52, 0.00, 90.00, 0.00);
- CreateDynamicObject(1647, 1896.55, -1854.38, 1501.44, 0.00, 0.00, 90.00);
- CreateDynamicObject(19426, 1895.14, -1851.17, 1501.34, 0.00, 90.00, 90.00);
- CreateDynamicObject(1626, 1898.16, -1847.96, 1501.71, 0.00, 0.00, 90.00);
- CreateDynamicObject(2523, 1898.03, -1857.53, 1500.51, 0.00, 0.00, 180.00);
- CreateDynamicObject(2528, 1895.92, -1857.22, 1500.51, 0.00, 0.00, 90.00);
- CreateDynamicObject(2526, 1897.10, -1855.46, 1500.51, 0.00, 0.00, 180.00);
- CreateDynamicObject(2740, 1896.98, -1856.55, 1503.71, 0.00, 0.00, 0.00);
- CreateDynamicObject(2635, 1901.27, -1848.07, 1500.93, 0.00, 0.00, 0.00);
- CreateDynamicObject(1722, 1901.49, -1849.36, 1500.51, 0.00, 0.00, 25.00);
- CreateDynamicObject(1722, 1899.95, -1847.81, 1500.51, 0.00, 0.00, -100.00);
- CreateDynamicObject(2831, 1901.16, -1848.22, 1501.36, 0.00, 0.00, 80.00);
- CreateDynamicObject(2313, 1901.49, -1850.50, 1500.51, 0.00, 0.00, -90.00);
- CreateDynamicObject(1781, 1901.82, -1851.18, 1501.02, 0.00, 0.00, -87.00);
- CreateDynamicObject(1712, 1899.09, -1852.00, 1500.50, 0.00, 0.00, 90.00);
- CreateDynamicObject(2830, 1895.66, -1850.62, 1501.43, 0.00, 0.00, 0.00);
- CreateDynamicObject(2894, 1901.44, -1851.81, 1501.01, 0.00, 0.00, -95.00);
- CreateDynamicObject(2258, 1901.83, -1850.94, 1502.73, 0.00, 0.00, -90.00);
- CreateDynamicObject(2847, 1900.84, -1851.78, 1500.52, 0.00, 0.00, 90.00);
- CreateDynamicObject(1742, 1901.96, -1855.45, 1500.51, 0.00, 0.00, -90.00);
- CreateDynamicObject(2573, 1901.39, -1861.24, 1500.51, 0.00, 0.00, -90.00);
- CreateDynamicObject(1794, 1898.67, -1861.44, 1500.51, 0.00, 0.00, 90.00);
- CreateDynamicObject(2576, 1898.38, -1863.94, 1500.51, 0.00, 0.00, -180.00);
- CreateDynamicObject(2817, 1899.89, -1861.48, 1500.51, 0.00, 0.00, 90.00);
- CreateDynamicObject(14869, 1895.62, -1859.07, 1501.21, 0.00, 0.00, 180.00);
- CreateDynamicObject(2238, 1895.34, -1859.64, 1501.77, 0.00, 0.00, 0.00);
- CreateDynamicObject(19174, 1897.64, -1858.22, 1502.68, 0.00, 0.00, 0.00);
- CreateDynamicObject(2844, 1896.45, -1857.28, 1500.52, 0.00, 0.00, 0.00);
- CreateDynamicObject(2819, 1896.35, -1860.49, 1501.18, 0.00, 0.00, -90.00);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement