[AJUDA]Sistema de evento de dm
#1

Bom pessoal eu tenho ese sistema de evnto (em fs) mas eu queria colocar um comando de congelar as pessoas do evento. se alguem poder me ajudar pf. e do rep+

#include <a_samp>

new Veiculos[212][25] =
{
"Landstalker","Bravura","Buffalo","Linerunner","Pe rrenial","Sentinel","Dumper","Firetruck","Trashmas ter",
"Stretch","Manana","Infernus","Voodoo","Pony","Mul e","Cheetah","Ambulance","Leviathan","Moonbeam" ,
"Esperanto","Taxi","Washington","Bobcat","Mr Whoopee","BF Injection","Hunter","Premier","Enforcer",
"Securicar","Banshee","Predator","Bus","Rhino","Ba rracks","Hotknife","Trailer 1","Previon","Coach",
"Cabbie","Stallion","Rumpo","RC Bandit","Romero","Packer","Monster","Admiral","Squ alo","Seasparrow",
"Pizzaboy","Tram","Trailer 2","Turismo","Speeder","Reefer","Tropic","Flatbed" ,"Yankee","Caddy","Solair",
"Berkley's RC Van","Skimmer","PCJ-600","Faggio","Freeway","RC Baron","RC Raider","Glendale","Oceanic",
"Sanchez","Sparrow","Patriot","Quad","Coastguard", "Dinghy","Hermes","Sabre","Rustler","ZR-350","Walton",
"Regina","Comet","BMX","Burrito","Camper","Marquis ","Baggage","Dozer","Maverick","News Chopper","Rancher",
"FBI Rancher","Virgo","Greenwood","Jetmax","Hotring","S andking","Blista Compact","Police Maverick","Boxville",
"Benson","Mesa","RC Goblin","Hotring Racer A","Hotring Racer B","Bloodring Banger","Rancher","Super GT",
"Elegant","Journey","Bike","Mountain Bike","Beagle","Cropdust","Stunt","Tanker","Roadtr ain","Nebula",
"Majestic","Buccaneer","Shamal","Hydra","FCR-900","NRG-500","HPV1000","Cement Truck","Tow Truck","Fortune",
"Cadrona","FBI Truck","Willard","Forklift","Tractor","Combine","F eltzer","Remington","Slamvan","Blade",
"Freight","Streak","Vortex","Vincent","Bullet","Cl over","Sadler","Firetruck LA","Hustler","Intruder",
"Primo","Cargobob","Tampa","Sunrise","Merit","Util ity","Nevada","Yosemite","Windsor","Monster A","Monster B",
"Uranus","Jester","Sultan","Stratum","Elegy","Rain dance","RC Tiger","Flash","Tahoma","Savanna","Bandito",
"Freight Flat","Streak Carriage","Kart","Mower","Duneride","Sweeper","Bro adway","Tornado","AT-400","DFT-30",
"Huntley","Stafford","BF-400","Newsvan","Tug","Trailer 3","Emperor","Wayfarer","Euros","Hotdog","Club" ,
"Freight Carriage","Trailer 3","Andromada","Dodo","RC Cam","Launch","Police Car (LSPD)","Police Car (SFPD)",
"Police Car (LVPD)","Police Ranger","Picador","S.W.A.T. Van","Alpha","Phoenix","Glendale","Sadler",
"Luggage Trailer A","Luggage Trailer B","Stair Trailer","Boxville","Farm Plow","Utility Trailer"
};

#define AMARELO 0xF9F900FF
#define VERMELHO 0xFF0000FF

enum FreeGells
{
Float:X,
Float:Y,
Float:Z,
Interior,
VirtualWorld,
bool:Trancado,
bool:Criado,
};
new Evento[FreeGells];
new Float:Pos[MAX_PLAYERS][4];
new Int[MAX_PLAYERS];
new VW[MAX_PLAYERS];
new Skin[MAX_PLAYERS];
new Cars[MAX_PLAYERS] = -1;
new bool:TaNoEvento[MAX_PLAYERS];

public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" - Sistema de Evento por Freegells");
print(" - Carregando...");
print(" - [KoS] Kings Of Samp");
print("--------------------------------------\n");
return 1;
}

public OnFilterScriptExit()
{
print("\n--------------------------------------");
print(" - Sistema de Evento por Freegells");
print(" - Descarregando...");
print(" - [KoS] Kings Of Samp");
print("--------------------------------------\n");
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])

{
new cmd[64], idx, tmp[64], String[128], n[MAX_PLAYER_NAME];
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/criarevento", true) == 0)
{
if(Evento[Criado]) return SendClientMessage(playerid, VERMELHO, "[ERRO] Jб existe um Evento criado!");
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, VERMELHO, "[ERRO] Vocк deve estar logado na Rcon!");
GetPlayerPos(playerid, Evento[X], Evento[Y], Evento[Z]);
Evento[VirtualWorld] = GetPlayerVirtualWorld(playerid);
Evento[Interior] = GetPlayerInterior(playerid);
GetPlayerName(playerid, n, MAX_PLAYER_NAME);
format(String, sizeof String, "[INFO] O Administrador %s criou um evento! Aguarde atй que o evento seja destrancado!", n);
SendClientMessageToAll(AMARELO, String);
Evento[Criado] = true;
Evento[Trancado] = true;
return 1;
}
if(strcmp(cmd, "/pevento", true) == 0)
{
if(!Evento[Criado]) return SendClientMessage(playerid, VERMELHO, "[ERRO] Nгo existe um evento criado!");
if(Evento[Trancado]) return SendClientMessage(playerid, VERMELHO, "[ERRO] Evento Trancado!");
if(TaNoEvento[playerid]) return SendClientMessage(playerid, VERMELHO, "[ERRO] Vocк jб estб no evento!");
GetPlayerPos(playerid, Pos[playerid][0], Pos[playerid][1], Pos[playerid][2]);
GetPlayerFacingAngle(playerid, Pos[playerid][3]);
SetCameraBehindPlayer(playerid);
Int[playerid] = GetPlayerInterior(playerid);
VW[playerid] = GetPlayerVirtualWorld(playerid);
Skin[playerid] = GetPlayerSkin(playerid);
SendClientMessage(playerid, AMARELO, "[INFO] Vocк se teleportou atй o Evento! Para sair do evento digite /psair.");
SetPlayerPos(playerid, Evento[X]+1, Evento[Y], Evento[Z]+0.5);
SetPlayerInterior(playerid, Evento[Interior]);
SetPlayerVirtualWorld(playerid, Evento[VirtualWorld]);
GetPlayerName(playerid, n, MAX_PLAYER_NAME);
TaNoEvento[playerid] = true;
for(new i, p = GetMaxPlayers(); i < p; i ++)
{
if(!TaNoEvento[i]) continue;
format(String, sizeof String, "[INFO] %s Entrou no Evento!", n);
SendClientMessage(i, AMARELO, String);
}
return 1;
}
if(strcmp(cmd, "/psair", true) == 0)
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, VERMELHO, "[ERRO] Vocк deve estar logado na Rcon!");
if(!Evento[Criado]) return SendClientMessage(playerid, VERMELHO, "[ERRO] Nгo existe um evento criado!");
if(!TaNoEvento[playerid]) return SendClientMessage(playerid, VERMELHO, "[ERRO] Vocк nгo estб no evento!");
GetPlayerName(playerid, n, MAX_PLAYER_NAME);
SetPlayerPos(playerid, Pos[playerid][0], Pos[playerid][1], Pos[playerid][2]);
SetPlayerFacingAngle(playerid, Pos[playerid][3]);
SetCameraBehindPlayer(playerid);
SetPlayerInterior(playerid, Int[playerid]);
SetPlayerVirtualWorld(playerid, VW[playerid]);
SetPlayerSkin(playerid, Skin[playerid]);
TaNoEvento[playerid] = false;
SendClientMessage(playerid, AMARELO, "[INFO] Vocк saiu do Evento !");
for(new i, p = GetMaxPlayers(); i < p; i ++)
{
if(!TaNoEvento[i]) continue;
format(String, sizeof String, "[INFO] %s Saiu do Evento!", n);
SendClientMessage(i, AMARELO, String);
}
return 1;
}
if(strcmp(cmd, "/terminarevento", true) == 0)
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, VERMELHO, "[ERRO] Vocк deve estar logado na Rcon!");
if(!Evento[Criado]) return SendClientMessage(playerid, VERMELHO, "[ERRO] Nгo existe um evento criado!");
GetPlayerName(playerid, n, MAX_PLAYER_NAME);
Evento[Criado] = false;
format(String, sizeof String, "[INFO] O Administrador %s Terminou o evento!", n);
SendClientMessageToAll(VERMELHO, String);
for(new i, p = GetMaxPlayers(); i < p; i ++)
{
if(!TaNoEvento[i]) continue;
SetPlayerPos(i, Pos[i][0], Pos[i][1], Pos[i][2]);
SetPlayerFacingAngle(i, Pos[i][3]);
SetCameraBehindPlayer(i);
SetPlayerInterior(i, Int[i]);
SetPlayerVirtualWorld(i, VW[i]);
SetPlayerSkin(i, Skin[i]);
TaNoEvento[i] = false;
}
for(new i = 0; i < sizeof Cars; i++) { DestroyVehicle(Cars[i]); }
return 1;
}
if(strcmp(cmd, "/trancarevento", true) == 0)
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, VERMELHO, "[ERRO] Vocк deve estar logado na Rcon!");
if(!Evento[Criado]) return SendClientMessage(playerid, VERMELHO, "[ERRO] Nгo existe um evento criado!");
if(Evento[Trancado]) return SendClientMessage(playerid, VERMELHO, "[ERRO] O Evento jб estб trancado!");
Evento[Trancado] = true;
GetPlayerName(playerid, n, MAX_PLAYER_NAME);
format(String, sizeof String, "[INFO] O Administrador %s trancou o evento! %s.", n, Check());
SendClientMessageToAll(AMARELO, String);
return 1;
}
if(strcmp(cmd, "/destrancarevento", true) == 0)
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, VERMELHO, "[ERRO] Vocк deve estar logado na Rcon!");
if(!Evento[Criado]) return SendClientMessage(playerid, VERMELHO, "[ERRO] Nгo existe um evento criado!");
if(!Evento[Trancado]) return SendClientMessage(playerid, VERMELHO, "[ERRO] O Evento nгo estб trancado!");
Evento[Trancado] = false;
GetPlayerName(playerid, n, MAX_PLAYER_NAME);
format(String, sizeof String, "[INFO] O Administrador %s Destrancou o evento! Use: /pevento", n);
SendClientMessageToAll(AMARELO, String);
return 1;
}
if(strcmp(cmd, "/parma", true) == 0)
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, VERMELHO, "[ERRO] Vocк deve estar logado na Rcon!");
if(!Evento[Criado]) return SendClientMessage(playerid, VERMELHO, "[ERRO] Nгo existe um evento criado!");
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, VERMELHO, "[ERRO] Use: /Prmar [ID DA ARMA] [MUNIЗГO]");
new Arma, Municao;
Arma = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, VERMELHO, "[ERRO] Use: /Parma [ID DA ARMA] [MUNIЗГO]");
Municao = strval(tmp);
if(Arma > 43) return SendClientMessage(playerid, VERMELHO, "[ERRO] ID Da arma entre 0 e 43!");
if(Municao < 1) return SendClientMessage(playerid, VERMELHO, "[ERRO] A muniзгo deve ser maior que 0!");
GetPlayerName(playerid, n, MAX_PLAYER_NAME);
for(new i, p = GetMaxPlayers(); i < p; i ++)
{
if(!TaNoEvento[i]) continue;
GivePlayerWeapon(i, Arma, Municao);
format(String, sizeof String, "[INFO] O Administrador %s deu a arma de id %d com %d balas para todos do evento!", n, Arma, Municao);
SendClientMessage(i, AMARELO, String);
}
return 1;
}
if(strcmp(cmd, "/pvida", true) == 0)
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, VERMELHO, "[ERRO] Vocк deve estar logado na Rcon!");
if(!Evento[Criado]) return SendClientMessage(playerid, VERMELHO, "[ERRO] Nгo existe um evento criado!");
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, VERMELHO, "[ERRO] Use: /Pvida [Quantia]");
new Vida = strval(tmp);
for(new i, p = GetMaxPlayers(); i < p; i ++)
{
if(!TaNoEvento[i]) continue;
SetPlayerHealth(i, Vida);
GetPlayerName(playerid, n, MAX_PLAYER_NAME);
format(String, sizeof String, "[INFO] O Administrador %s Setou a vida de todos do Evento para %d!", n, Vida);
SendClientMessage(i, AMARELO, String);
}
return 1;
}
if(strcmp(cmd, "/pcolete", true) == 0)
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, VERMELHO, "[ERRO] Vocк deve estar logado na Rcon!");
if(!Evento[Criado]) return SendClientMessage(playerid, VERMELHO, "[ERRO] Nгo existe um evento criado!");
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, VERMELHO, "[ERRO] Use: /Pcolete [Quantia]");
new Colete = strval(tmp);
for(new i, p = GetMaxPlayers(); i < p; i ++)
{
if(!TaNoEvento[i]) continue;
SetPlayerArmour(i, Colete);
GetPlayerName(playerid, n, MAX_PLAYER_NAME);
format(String, sizeof String, "[INFO] O Administrador %s Setou o colete de todos do Evento para %d!", n, Colete);
SendClientMessage(i, AMARELO, String);
}
return 1;
}
if(strcmp(cmd, "/skinevento", true) == 0)
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, VERMELHO, "[ERRO] Vocк deve estar logado na Rcon!");
if(!Evento[Criado]) return SendClientMessage(playerid, VERMELHO, "[ERRO] Nгo existe um evento criado!");
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, VERMELHO, "[ERRO] Use: /skinEvento [Skin]");
if(strval(tmp) < 0 || strval(tmp) > 299) return SendClientMessage(playerid, VERMELHO, "A skin deve estar entre 0 e 299.");
for(new i, p = GetMaxPlayers(); i < p; i ++)
{
if(!TaNoEvento[i]) continue;
SetPlayerSkin(i, strval(tmp));
GetPlayerName(playerid, n, MAX_PLAYER_NAME);
format(String, sizeof String, "[INFO] O Administrador %s trocou a skin de todos do Evento para %d!", n, strval(tmp));
SendClientMessage(i, AMARELO, String);
}
return 1;
}
if(strcmp(cmd, "/carevento", true) == 0)
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, VERMELHO, "[ERRO] Vocк deve estar logado na Rcon!");
if(!Evento[Criado]) return SendClientMessage(playerid, VERMELHO, "[ERRO] Nгo existe um evento criado!");
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, VERMELHO, "[ERRO] Use: /carevento [MODELO]");
new Modelo = strval(tmp), Float, Float:y, Float:z;
if(Modelo < 400 || Modelo > 611) return SendClientMessage(playerid, VERMELHO, "[ERRO] O modelo do veiculo deve ser maior que 400 e menor que 611!");
for(new i = 0; i < sizeof Cars; i ++) { DestroyVehicle(Cars[i]); Cars[i] = -1; }
GetPlayerName(playerid, n, MAX_PLAYER_NAME);
for(new i, p = GetMaxPlayers(); i < p; i++)
{
if(!TaNoEvento[i]) continue;
GetPlayerPos(i, x, y, z);
Cars[i] = CreateVehicle(Modelo, x, y, z, 0, random(255), random(255), -1);
PutPlayerInVehicle(i, Cars[i], 0);
LinkVehicleToInterior(Cars[i], GetPlayerInterior(i));
AddVehicleComponent(Cars[i], 1010);
format(String, sizeof String, "[INFO] O Administrador %s deu o veiculo %s para todos do Evento!", n, Veiculos[Modelo-400]);
SendClientMessage(i, AMARELO, String);
}
return 1;
}
if(strcmp(cmd, "/pcomandos", true) == 0)
{
new str[900];
strcat(str, "\n/criarevento - Serve para criar um evento.\n");
strcat(str, "/terminarevento - Serve para terminar um evento.\n");
strcat(str, "/pvida - Serve para dar uma determinada quantidade de vida para os jogadores que estгo no evento.\n");
strcat(str, "/pcolete - Serve para dar uma certa quantidade de colete para os jogadores que estгo no evento.\n");
strcat(str, "/parma - Serve para dar armas para os jogadores que estгo no evento.\n");
strcat(str, "/carevento - Serve para dar aos jogadores que estгo no evento um veiculo.\n");
strcat(str, "/pdesistir - Serve para sair do evento.\n");
strcat(str, "/pevento - Serve para entrar no evento.\n");
strcat(str, "/trancarevento - Serve para trancar o evento.\n");
strcat(str, "/destrancarevento - Serve para destrancar o evento.\n");
strcat(str, "/skinevento - Serve para trocar a skin dos jogadores que estгo no evento.\n\n");
ShowPlayerDialog(playerid, 794, DIALOG_STYLE_MSGBOX, "Comandos FS EVENTO:", str, "Fechar", "");
return 1;
}
return 0;
}

public OnVehicleDeath(vehicleid)
{
for(new i = 0; i < sizeof Cars; i ++)
{
if(Cars[i] == vehicleid)
{
DestroyVehicle(vehicleid); break;
}
}
return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(oldstate == 2)
{
if(GetVehicleModel(Cars[playerid])) { DestroyVehicle(Cars[playerid]); }
}
return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
if(TaNoEvento[playerid]) { TaNoEvento[playerid] = false; }
if(GetVehicleModel(Cars[playerid])) { DestroyVehicle(Cars[playerid]); }
return 1;
}

strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}

new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}

stock Check()
{
new players, str[64];
for(new i, p = GetMaxPlayers(); i < p; i ++)
{
if(!IsPlayerConnected(i) || !TaNoEvento[i]) continue;
players++;
}
if(!players) { str = "Nenhum jogador entrou"; }
else if(players == 1) { str = "1 jogador entrou"; }
else { format(str, sizeof str, "%d jogadores entraram", players); }
return str;
}

stock Check2()
{
new players;
for(new i, p = GetMaxPlayers(); i < p; i ++)
{
if(!IsPlayerConnected(i) || !TaNoEvento[i]) continue;
players++;
}
return players;
}
Reply
#2

Poem o source entre [*pawn] [/pawn] (Sem *).

TogglePlayerControllable

Use essa funзгo junto a um loop que passe por todos os players do evento, serб necessбrio usar uma variбvel do tipo:

pawn Код:
new Evento [ MAX_PLAYERS ];
Para verificar os jogadores que estгo no evento.

Boa Sorte Qualquer dъvida sу falar no tуpico.
Reply
#3

Amigo usa o [*pawn][/pawn]

Ps: Tirar o *
Reply
#4

Quote:
Originally Posted by powerths
Посмотреть сообщение
Amigo usa o [*pawn][/pawn]

Ps: Tirar o *
O que foi que eu disse? ¬¬

Esses cara querendo ganhar post й foda.
Reply
#5

Quote:
Originally Posted by Juniiro3
Посмотреть сообщение
Poem o source entre [*pawn] [/pawn] (Sem *).

TogglePlayerControllable

Use essa funзгo junto a um loop que passe por todos os players do evento, serб necessбrio usar uma variбvel do tipo:

pawn Код:
new Evento [ MAX_PLAYERS ];
Para verificar os jogadores que estгo no evento.

Boa Sorte Qualquer dъvida sу falar no tуpico.
eu queria criar um cmd pra congelar tds do evento pow. mas nao sei como
Reply
#6

Quote:
Originally Posted by Juniiro3
Посмотреть сообщение
O que foi que eu disse? ¬¬

Esses cara querendo ganhar post й foda.
Na boa se eu quisesse ganhar post ja respondia todos os topico to dando uma dica para ele organizar o codigo dele no forum.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)