//////////////////////////////////////////////////
//////////////////////////////////////////////////
/// Matraka's Checkpoint Streamer ///
/// ///
/// Author: [MPA]matraka_IDG ///
/// Contact: msn_matraka@gtabrasil.net ///
/// ///
/// ---===Infernus Development Group===--- ///
//////////////////////////////////////////////////
//////////////////////////////////////////////////
#include <a_samp>
/*Natives
native CPS_AddCheckpoint(Float:X,Float:Y,Float:Z,Float:size,Float:spawn_dist);
native CPS_IsPlayerInCheckpoint(playerid,cpid);
native CPS_IsPlayerInAnyCheckpoint(playerid,cpid);
native CPS_RemoveCheckpoint(cpid);
native CPS_GetPlayerCheckpoint(playerid);
*/
#define MAX_CHECKPOINTS 500
forward CPSERVICE_Handler();
enum cpinfo
{
Float:cpX,
Float:cpY,
Float:cpZ,
Float:cpsz,
cpsd,
};
new CPSERVICE_active;
new Checkpoints[MAX_CHECKPOINTS][cpinfo];
new UsedCPSlot[MAX_CHECKPOINTS];
new CPSERVICE_actualcp[MAX_PLAYERS];
stock CPS_AddCheckpoint(Float:X,Float:Y,Float:Z,Float:size,spawn_dist)
{
new cpid=1;
while(UsedCPSlot[cpid] == 1) cpid++;
if(CPSERVICE_active == 0){
SetTimer("CPSERVICE_Handler",500,true);
CPSERVICE_active=1;
}
UsedCPSlot[cpid]=1;
Checkpoints[cpid][cpX]=X;
Checkpoints[cpid][cpY]=Y;
Checkpoints[cpid][cpZ]=Z;
Checkpoints[cpid][cpsz]=size;
Checkpoints[cpid][cpsd]=spawn_dist;
return cpid;
}
stock CPS_IsPlayerInCheckpoint(playerid,cpid)
{
if(!IsPlayerInCheckpoint(playerid)) return 0;
if(CPSERVICE_actualcp[playerid] == cpid) return 1;
else return 0;
}
stock CPS_IsPlayerInAnyCheckpoint(playerid)
{
if(!IsPlayerInCheckpoint(playerid)) return 0;
if(CPSERVICE_actualcp[playerid] == 0) return 0;
else return 1;
}
stock CPS_GetPlayerCheckpoint(playerid) if(!IsPlayerInCheckpoint(playerid)) return 0; else return CPSERVICE_actualcp[playerid];
stock CPS_RemoveCheckpoint(cpid)
{
if(cpid == 0 || UsedCPSlot[cpid] == 0) return 0;
UsedCPSlot[cpid]=0;
return 1;
}
public CPSERVICE_Handler()
{
for(new i; i<MAX_PLAYERS; i++){
new Float:prevdist = 100000.000;
new prevcp;
for(new cpid=1; cpid < MAX_CHECKPOINTS; cpid++){
if(UsedCPSlot[cpid]) {
new Float:dist;
dist = CPSERVICE_getdist(i,Checkpoints[cpid][cpX],Checkpoints[cpid][cpY],Checkpoints[cpid][cpZ]);
if(dist < prevdist){
prevdist = dist;
prevcp = cpid;
}
}
}
new cpid=prevcp;
if(CPSERVICE_getdist(i,Checkpoints[cpid][cpX],Checkpoints[cpid][cpY],Checkpoints[cpid][cpZ]) < Checkpoints[cpid][cpsd]) {
if(CPSERVICE_actualcp[i] != cpid){
SetPlayerCheckpoint(i,Checkpoints[cpid][cpX],Checkpoints[cpid][cpY],Checkpoints[cpid][cpZ],Checkpoints[cpid][cpsz]);
CPSERVICE_actualcp[i] = cpid;
}
} else {
if(CPSERVICE_actualcp[i] != 0){
CPSERVICE_actualcp[i] = 0;
DisablePlayerCheckpoint(i);
}
}
}
return 1;
}
stock CPSERVICE_getdist(playerid,Float:x2,Float:y2,Float:z2)
{
new Float:x1,Float:y1,Float:z1;
new Float:tmpdis;
GetPlayerPos(playerid,x1,y1,z1);
tmpdis = floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
return floatround(tmpdis);
}
C:\Users\Gustavo\Desktop\SVV\pawno\include\cpstrea m.inc(0) : error 075: input line too long (after substitutions) C:\Users\Gustavo\Desktop\SVV\pawno\include\cpstrea m.inc(1) : error 075: input line too long (after substitutions) C:\Users\Gustavo\Desktop\SVV\pawno\include\cpstrea m.inc(2) : error 075: input line too long (after substitutions) C:\Users\Gustavo\Desktop\SVV\pawno\include\cpstrea m.inc(6) : error 010: invalid function or declaration ../include/streamer.inc(449) : warning 202: number of arguments does not match definition C:\Users\Gustavo\Desktop\SVV\gamemodes\BSL.pwn(309 4) : error 017: undefined symbol "CPS_AddCheckpoint" C:\Users\Gustavo\Desktop\SVV\gamemodes\BSL.pwn(309 5) : error 017: undefined symbol "CPS_AddCheckpoint" C:\Users\Gustavo\Desktop\SVV\gamemodes\BSL.pwn(309 6) : error 017: undefined symbol "CPS_AddCheckpoint" C:\Users\Gustavo\Desktop\SVV\gamemodes\BSL.pwn(309 7) : error 017: undefined symbol "CPS_AddCheckpoint" C:\Users\Gustavo\Desktop\SVV\gamemodes\BSL.pwn(158 1 : error 017: undefined symbol "CPS_IsPlayerInCheckpoint" C:\Users\Gustavo\Desktop\SVV\gamemodes\BSL.pwn(158 27) : error 017: undefined symbol "CPS_IsPlayerInCheckpoint" C:\Users\Gustavo\Desktop\SVV\gamemodes\BSL.pwn(158 36) : error 017: undefined symbol "CPS_IsPlayerInCheckpoint" C:\Users\Gustavo\Desktop\SVV\gamemodes\BSL.pwn(158 45) : error 017: undefined symbol "CPS_IsPlayerInCheckpoint" C:\Users\Gustavo\Desktop\SVV\gamemodes\BSL.pwn(286 49) : warning 202: number of arguments does not match definition C:\Users\Gustavo\Desktop\SVV\gamemodes\BSL.pwn(309 6) : warning 204: symbol is assigned a value that is never used: "CP_burgermenu" C:\Users\Gustavo\Desktop\SVV\gamemodes\BSL.pwn(309 7) : warning 204: symbol is assigned a value that is never used: "CP_chickenmenu" C:\Users\Gustavo\Desktop\SVV\gamemodes\BSL.pwn(309 4) : warning 204: symbol is assigned a value that is never used: "CP_donutshop" C:\Users\Gustavo\Desktop\SVV\gamemodes\BSL.pwn(309 5) : warning 204: symbol is assigned a value that is never used: "CP_pizzamenu" C:\Users\Gustavo\Desktop\SVV\gamemodes\BSL.pwn(309 5 -- 62893) : warning 203: symbol is never used: "cpid" Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 12 Errors. |
new Portao; //CRIA UMA ARRAY QUE SERБ USADA PARA DEFINIR O PORTAO
new Gabriel; //SERБ USADA PARA DIZER SE O PORTAO ESTБ ABERTO OU FECHADO
public OnGameModeInit()
{
Portao = CreateObject(/*MODELO*/,/*COORDENADA X*/,/*COORDENADA Y*/,/*COORDENADA Z*/,/*ANGULO DE ROTACAO X*/,/*ANGULO DE ROTACAO Y*/,/*ANGULO DE ROTACAO Z*/); //DEFINE QUE O OBJETO CRIADO SERБ CHAMADO DE "Portao"
return 1;
}
public OnPlayerCommandText(playerid,cmdtext[])
{
new
idx,
cmd[256];
cmd = strtok(cmdtext,idx);
if(strcmp(cmd,"/abrirp",true)) //SE O COMANDO FOR /abrirp A FUNЗГO ABAIXO SERБ EXECUTADA
{
if(Gabriel == 0)
{
MoveObject(Portao,/*COORDENADA X*/,/*COORDENADA Y*/,/*COORDENADA Z*/,/*VELOCIDADE*/); //IRБ MOVER O PORTAO PARA O LOCAL DE ABERTURA
Gabriel = 1; //DEFINE QUE Gabriel Й IGUAL A 1
SendClientMessage(playerid,0xFFFFFFFF,"O portao foi aberto."); //MANDA MENSAGEM AO JOGADOR
}
else
{
MoveObject(Portao,/*COORDENADA X*/,/*COORDENADA Y*/,/*COORDENADA Z*/,/*VELOCIDADE*/); //FECHA O PORTAO NAS COORDENADAS QUE VOCК COLOCAR
Gabriel = 0; //USAREMOS ESTA VARIAVEL PARA DEFINIR SE O PORTAO ESTБ FECHADO OU NГO
SendClientMessage(playerid,0xFFFFFFFF,"O portao foi fechado.");
}
return 1;
}
return 0;
}
//==============================[ caso vocк queira que o portao seja fechado em um determinado tempo use o codigo a seguir ]==============================
new Portao;
forward FecharPortao(); //DECLARA A PUBLIC
public OnGameModeInit()
{
Portao = CreateObject(/*MODELO*/,/*COORDENADA X*/,/*COORDENADA Y*/,/*COORDENADA Z*/,/*ANGULO DE ROTACAO X*/,/*ANGULO DE ROTACAO Y*/,/*ANGULO DE ROTACAO Z*/);
return 1;
}
public OnPlayerCommandText(playerid,cmdtext[])
{
new
idx,
cmd[256];
cmd = strtok(cmdtext,idx);
if(strcmp(cmd,"/abrirp",true)) //SE O COMANDO FOR /abrirp A FUNЗГO ABAIXO SERБ EXECUTADA
{
MoveObject(Portao,/*COORDENADA X*/,/*COORDENADA Y*/,/*COORDENADA Z*/,/*VELOCIDADE*/);
SendClientMessage(playerid,0xFFFFFFFF,"O portao foi aberto e serб fechado em 10 segundos.");
SetTimer("FecharPortao",10000,false); //ACIONA UM TIMER DE 10 SEGUNDOS QUE IRБ EXECUTAR A PUBLIC ABAIXO
return 1;
}
return 0;
}
public FecharPortao() //PUBLIC QUE FECHA O PORTAO
{
MoveObject(Portao,/*COORDENADA X*/,/*COORDENADA Y*/,/*COORDENADA Z*/,/*VELOCIDADE*/);
return 1;
}