SA-MP Forums Archive
[Tutorial] Organizaзгo de Interiores e VirtualWords [Entraveis] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+----- Forum: Lançamentos/Releases (https://sampforum.blast.hk/forumdisplay.php?fid=56)
+----- Thread: [Tutorial] Organizaзгo de Interiores e VirtualWords [Entraveis] (/showthread.php?tid=652181)



Organizaзгo de Interiores e VirtualWords [Entraveis] - RazorGuigo - 04.04.2018

este tutorial й uma dica, de como se organizar bem e facilitar a criaзгo de lugares entraveis em seu GameMode


NOTAS:
o que se preocupar?
Vocк armazenara os nomes em matrizes, cada lugar tera seu WD prуprio e vocк nгo deve se preocupar com este numero, apenas com seu respectivo nome.
Quote:

_MUNDO
_PREF_LS
_PREF_SF
_DP_LS

Codficaзгo:
Estбs sгo as informaзхes que precisam de atenзгo posteriormente
PHP код:
enum INTERIOR_INFO
{
    
I_interior,
    
I_nome[32]

a seguir a enumeraзгo de interiores, eles recebem um virtualworld, conforme a ordem, e isso й a grande jogada, vocк nгo se preocupa com nъmeros, apenas com as suas definiзхes, uma dor de cabeзa a menos
PHP код:
enum INTERIORES
{
    
_MUNDO,    
    
_PREF_LS,
    
_PREF_SF,
    
_DP_LS

a ordem de INTERIORES deve ser a mesma de _Interior, para correspondam igualmente.
Capturar as coordenadas corretas:
PHP код:
//primeiro valor й o interior (й a parte visual do mapa que o local pertence)
//segundo valor й o nome (caso precise utilizar em algum momento)
new _Interior[INTERIORES][INTERIOR_INFO]=
{
    {
0,                "Mundo"},
    {
3,                "Prefeitura LS"},
    {
3,                "Prefeitura SF"},
    {
6,                "Delegacia LS"}
}
//sabendo essas informaзхes e as armazenando pode simplesmente esquece-las 
Funзхes e Macros:

PHP код:
//este macro vai te ajudar em diversas aplicaзхes tanto suas quantos de terceiros (SIF,STREAMER,MCF-CP)
#define INTERIOR<%0>    _:%0,_Interior[%0][I_interior]
stock GetWord(i)
    return 
_:i;
stock GetInterior(i)
    return 
_:_Interior[_:i][I_interior];
stock GetInteriorNome(wordid)
    return 
_Interior[_:wordid][I_nome];
//caso nгo tenha um script de teleporte similar, aqui estб o meu:
function TeleportCP(playeridFloat:xFloat:yFloat:z,wd,i)
{
    
SetPlayerInterior(playeridi);
    
SetPlayerPos(playeridx,y,z);
    
SetPlayerVirtualWorld(playeridwd);
    return 
1;

Exemplos extras:

PHP код:
public OnGameModeInit()
{
    
CreateButton(244.898437,73.343383,1003.000,"",INTERIOR<_DP_LS>); // SIF
    
CreateDynamicObject(19273247.7536072.383901004.00000,   0.000000.000000.00000,INTERIOR<_DP_LS>);//Streamer
    
CreateCheckPoint("dp"CP_CIRCLE0x99FF0000249.3933,69.70721003.6406,INTERIOR<_DP_LS>);//MCF-CP
    
return 1;

Exemplo de entraveis:
Nгo documentei e comentei muito este codigo, porque tenho dificuldades de fazer uma explicaзгo extensa,
porem ele estб bastante intuitivo e simples de se entender, nada massivo e complexo!
PHP код:
#include <MCF-CP>
#include <streamer>
//MACROS para facilitar visualisгo e abreviaзгo do codigo
#define TELEPORTE_FROM_POS<%0>    _TELE[%0][FromX],_TELE[%0][FromY],_TELE[%0][FromZ],INTERIOR<INTERIORES:_TELE[%0][Fi]>
#define TELEPORTE_TO_POS<%0>    _TELE[%0][ToX],_TELE[%0][ToY],_TELE[%0][ToZ],INTERIOR<INTERIORES:_TELE[%0][Ti]>
#define MAX_TELEPORTES     5
static CPT[MAX_TELEPORTES];            //CheckPoint Teleporte
static LastCPT[MAX_PLAYERS];        //ultimo CheckPoint de telerpote
enum TELE_INFO
{
    
Float:FromX,
    
Float:FromY,
    
Float:FromZ,
    
Fi,
    
Float:ToX,
    
Float:ToY
    
Float:ToZ,
    
Ti,
    
Tmessage[100]
}
static 
_TELE[MAX_TELEPORTES][TELE_INFO]=
{
    {
246.7840,63.9002,1003.6406,_:_DP_LS,        1553.9879,-1675.4504,16.2953_:_MUNDO"~w~Precisone: ~g~~h~(F)~w~ para sair da delegacia"},
    {
246.3030,87.2807,1003.6406,_:_DP_LS,        1525.4456,-1678.0431,5.8906_:_MUNDO"~w~Precisone: ~g~~h~(F)~w~ para sair da delegacia"},
    {
1553.9879,-1675.4504,16.2953,_:_MUNDO,        246.7840,63.90021003.6406_:_DP_LS"~w~Precisone: ~g~~h~(F)~w~ para entrar na delegacia"},
    {
1568.6914,-1691.1642,5.8906,_:_MUNDO,        246.3030,87.28071003.6406_:_DP_LS"~w~Precisone: ~g~~h~(F)~w~ para entrar na delegacia"},
    {
1525.4456,-1678.0431,5.8906,_:_MUNDO,        246.3030,87.28071003.6406_:_DP_LS"~w~Precisone: ~g~~h~(F)~w~ para entrar na delegacia"},
};
public 
OnGameModeInit()
{
    for(new 
0MAX_TELEPORTESi++)//criaзгo de todos os CheckPoint de teleporte
        
CPT[i]=CreateCheckPoint("entrar"CP_INVISIBLE 0x99FF0000TELEPORTE_FROM_POS<i>);
    
    
//-------------------------------------
    
CreateDynamicPickup(191971,246.7840,63.90021003.64044INTERIOR<_DP_LS>);//visual dos pickups sгo bem bonitos
    
CreateDynamicPickup(191971,246.3030,87.28071003.64044INTERIOR<_DP_LS>);
    
CreateDynamicPickup(191971,1553.9879,-1675.4504,16.2953INTERIOR<_MUNDO>);
    
CreateDynamicPickup(191971,1525.4456,-1678.0431,5.89060INTERIOR<_MUNDO>);
    
CreateDynamicPickup(191971,1568.6914,-1691.1642,5.8906,  INTERIOR<_MUNDO>);
    
//----------------------------------------
    
return 1;
}
CPEnter:entrar(playeridCPID
{
    for(new 
0MAX_TELEPORTESi++)
    {
        if(
IsPlayerInCP(playeridCPT[i]))
        {
            
GameTextForPlayer(playerid_TELE[i][Tmessage], 40004);
            
LastCPT[playerid]=i;
            return 
1;
        }
    }
    return 
1;
}
public 
OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    if(
GetPlayerState(playerid) != PLAYER_STATE_ONFOOT)
        return 
1;
    if(!
PRESSED(KEY_SECONDARY_ATTACK))
        return 
1;
    if(
IsPlayerInCP(playerid,CPT[LastCPT[playerid]]))
        return 
TeleportCP(playeridTELEPORTE_TO_POS<LastCPT[playerid]>);
    return 
1;

IMPORTANTE:
estб й a parte que realmente merece atenзгo sua, para criar entraveis, vocк apenas precisa colocar as coordenadas, interiores e textos, o resto jб esta tudo prontinho, organizado, para que facilite ao mбximo a escalabilidade!
PHP код:
static _TELE[MAX_TELEPORTES][TELE_INFO]= 

    {
246.7840,63.9002,1003.6406,_:_DP_LS,        1553.9879,-1675.4504,16.2953_:_MUNDO"~w~Precisone: ~g~~h~(F)~w~ para sair da delegacia"}, 
    {
246.3030,87.2807,1003.6406,_:_DP_LS,        1525.4456,-1678.0431,5.8906_:_MUNDO"~w~Precisone: ~g~~h~(F)~w~ para sair da delegacia"}, 
    {
1553.9879,-1675.4504,16.2953,_:_MUNDO,        246.7840,63.90021003.6406_:_DP_LS"~w~Precisone: ~g~~h~(F)~w~ para entrar na delegacia"}, 
    {
1568.6914,-1691.1642,5.8906,_:_MUNDO,        246.3030,87.28071003.6406_:_DP_LS"~w~Precisone: ~g~~h~(F)~w~ para entrar na delegacia"}, 
    {
1525.4456,-1678.0431,5.8906,_:_MUNDO,        246.3030,87.28071003.6406_:_DP_LS"~w~Precisone: ~g~~h~(F)~w~ para entrar na delegacia"}, 
}; 
Veja como ficou simples e pratico! bons treinos e boa sorte!



CREDITOS:
Quote:
RazorG: Tutorial e Elaboraзгo do Cуdigo!



MULTI COLERED FUNCTIONAL CP:
Forum: https://sampforum.blast.hk/showthread.php?tid=635066
GitHub: https://github.com/RodrigoDornelles/MCF-CheckPoint


Re: Organizaзгo de Interiores e VirtualWords [Entraveis] - NelsonC - 04.04.2018

Boa, bem ъtil e mais organizado.


Re: Organizaзгo de Interiores e VirtualWords [Entraveis] - Ryuzaki07 - 04.04.2018

Tutorial ficou muito bom, e simples, mas vocк pode disponibilizar a include MCF-CP ? Nгo estou conseguindo acha-la.


Re: Organizaзгo de Interiores e VirtualWords [Entraveis] - Marllun - 04.04.2018

pq o _ na frente dos nomes?


Porque eu quiz - RazorGuigo - 04.04.2018

Quote:
Originally Posted by Marllun
Посмотреть сообщение
pq o _ na frente dos nomes?
literalmente, й esse o motivo mesmo, kkkkkkk ficou mais fбcil de eu visualizar


Re: Organizaзгo de Interiores e VirtualWords [Entraveis] - Marllun - 04.04.2018

ah kk, gostei do tutorial +rep.


Re: Organizaзгo de Interiores e VirtualWords [Entraveis] - beybedragon - 05.04.2018

Quote:
Originally Posted by Ryuzaki07
Посмотреть сообщение
Tutorial ficou muito bom, e simples, mas vocк pode disponibilizar a include MCF-CP ? Nгo estou conseguindo acha-la.
https://raw.githubusercontent.com/Ro.../master/cp.inc

ta na assinatura dele


Re: Organizaзгo de Interiores e VirtualWords [Entraveis] - Ryuzaki07 - 08.04.2018

C:\Users\Lawlliet\Desktop\Meu servidor\pawno\include\cp.inc(460) : error 025: function heading differs from prototype
C:\Users\Lawlliet\Desktop\Meu servidor\pawno\include\cp.inc(460) : error 017: undefined symbol "areaid"
C:\Users\Lawlliet\Desktop\Meu servidor\pawno\include\cp.inc(464) : error 021: symbol already defined: "Streamer_GetArrayData"
C:\Users\Lawlliet\Desktop\Meu servidor\pawno\include\cp.inc(465) : error 010: invalid function or declaration
C:\Users\Lawlliet\Desktop\Meu servidor\pawno\include\cp.inc(471) : error 010: invalid function or declaration
C:\Users\Lawlliet\Desktop\Meu servidor\pawno\include\cp.inc(47 : error 010: invalid function or declaration
C:\Users\Lawlliet\Desktop\Meu servidor\pawno\include\cp.inc(483) : error 010: invalid function or declaration
C:\Users\Lawlliet\Desktop\Meu servidor\pawno\include\cp.inc(48 : error 010: invalid function or declaration
C:\Users\Lawlliet\Desktop\Meu servidor\pawno\include\cp.inc(490) : error 054: unmatched closing brace ("}")
C:\Users\Lawlliet\Desktop\Meu servidor\pawno\include\cp.inc(503) : error 025: function heading differs from prototype
C:\Users\Lawlliet\Desktop\Meu servidor\pawno\include\cp.inc(503) : error 017: undefined symbol "areaid"
C:\Users\Lawlliet\Desktop\Meu servidor\pawno\include\cp.inc(506) : error 021: symbol already defined: "arr"
C:\Users\Lawlliet\Desktop\Meu servidor\pawno\include\cp.inc(50 : error 010: invalid function or declaration
C:\Users\Lawlliet\Desktop\Meu servidor\pawno\include\cp.inc(512) : error 021: symbol already defined: "CPID"
C:\Users\Lawlliet\Desktop\Meu servidor\pawno\include\cp.inc(514) : error 010: invalid function or declaration
C:\Users\Lawlliet\Desktop\Meu servidor\pawno\include\cp.inc(521) : error 010: invalid function or declaration
C:\Users\Lawlliet\Desktop\Meu servidor\pawno\include\cp.inc(526) : error 010: invalid function or declaration
C:\Users\Lawlliet\Desktop\Meu servidor\pawno\include\cp.inc(531) : error 010: invalid function or declaration
C:\Users\Lawlliet\Desktop\Meu servidor\pawno\include\cp.inc(533) : error 054: unmatched closing brace ("}")
C:\Users\Lawlliet\Desktop\entrada.pwn(111) : error 017: undefined symbol "CreateButton"
C:\Users\Lawlliet\Desktop\entrada.pwn(111) : warning 202: number of arguments does not match definition
C:\Users\Lawlliet\Desktop\entrada.pwn(111) : error 001: expected token: ",", but found ";"
C:\Users\Lawlliet\Desktop\entrada.pwn(112) : error 017: undefined symbol "INTERIOR"
C:\Users\Lawlliet\Desktop\entrada.pwn(112) : error 001: expected token: ",", but found ";"
C:\Users\Lawlliet\Desktop\entrada.pwn(113) : error 017: undefined symbol "INTERIOR"
C:\Users\Lawlliet\Desktop\entrada.pwn(113) : error 001: expected token: ",", but found ";"
C:\Users\Lawlliet\Desktop\entrada.pwn(117) : error 017: undefined symbol "MAX_TELEPORTES"

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


26 Errors.

O meu deu esses erros, em linhas que nгo tem.

https://pastebin.com/w39ExQEP Tentei colocar ele em um new.pwn


Re: Organizaзгo de Interiores e VirtualWords [Entraveis] - VinteDois - 09.04.2018

Quote:
Originally Posted by Ryuzaki07
Посмотреть сообщение
C:\Users\Lawlliet\Desktop\Meu servidor\pawno\include\cp.inc(460) : error 025: function heading differs from prototype
C:\Users\Lawlliet\Desktop\Meu servidor\pawno\include\cp.inc(460) : error 017: undefined symbol "areaid"
C:\Users\Lawlliet\Desktop\Meu servidor\pawno\include\cp.inc(464) : error 021: symbol already defined: "Streamer_GetArrayData"
C:\Users\Lawlliet\Desktop\Meu servidor\pawno\include\cp.inc(465) : error 010: invalid function or declaration
C:\Users\Lawlliet\Desktop\Meu servidor\pawno\include\cp.inc(471) : error 010: invalid function or declaration
C:\Users\Lawlliet\Desktop\Meu servidor\pawno\include\cp.inc(47 : error 010: invalid function or declaration
C:\Users\Lawlliet\Desktop\Meu servidor\pawno\include\cp.inc(483) : error 010: invalid function or declaration
C:\Users\Lawlliet\Desktop\Meu servidor\pawno\include\cp.inc(48 : error 010: invalid function or declaration
C:\Users\Lawlliet\Desktop\Meu servidor\pawno\include\cp.inc(490) : error 054: unmatched closing brace ("}")
C:\Users\Lawlliet\Desktop\Meu servidor\pawno\include\cp.inc(503) : error 025: function heading differs from prototype
C:\Users\Lawlliet\Desktop\Meu servidor\pawno\include\cp.inc(503) : error 017: undefined symbol "areaid"
C:\Users\Lawlliet\Desktop\Meu servidor\pawno\include\cp.inc(506) : error 021: symbol already defined: "arr"
C:\Users\Lawlliet\Desktop\Meu servidor\pawno\include\cp.inc(50 : error 010: invalid function or declaration
C:\Users\Lawlliet\Desktop\Meu servidor\pawno\include\cp.inc(512) : error 021: symbol already defined: "CPID"
C:\Users\Lawlliet\Desktop\Meu servidor\pawno\include\cp.inc(514) : error 010: invalid function or declaration
C:\Users\Lawlliet\Desktop\Meu servidor\pawno\include\cp.inc(521) : error 010: invalid function or declaration
C:\Users\Lawlliet\Desktop\Meu servidor\pawno\include\cp.inc(526) : error 010: invalid function or declaration
C:\Users\Lawlliet\Desktop\Meu servidor\pawno\include\cp.inc(531) : error 010: invalid function or declaration
C:\Users\Lawlliet\Desktop\Meu servidor\pawno\include\cp.inc(533) : error 054: unmatched closing brace ("}")
C:\Users\Lawlliet\Desktop\entrada.pwn(111) : error 017: undefined symbol "CreateButton"
C:\Users\Lawlliet\Desktop\entrada.pwn(111) : warning 202: number of arguments does not match definition
C:\Users\Lawlliet\Desktop\entrada.pwn(111) : error 001: expected token: ",", but found ";"
C:\Users\Lawlliet\Desktop\entrada.pwn(112) : error 017: undefined symbol "INTERIOR"
C:\Users\Lawlliet\Desktop\entrada.pwn(112) : error 001: expected token: ",", but found ";"
C:\Users\Lawlliet\Desktop\entrada.pwn(113) : error 017: undefined symbol "INTERIOR"
C:\Users\Lawlliet\Desktop\entrada.pwn(113) : error 001: expected token: ",", but found ";"
C:\Users\Lawlliet\Desktop\entrada.pwn(117) : error 017: undefined symbol "MAX_TELEPORTES"

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


26 Errors.

O meu deu esses erros, em linhas que nгo tem.

https://pastebin.com/w39ExQEP Tentei colocar ele em um new.pwn
https://raw.githubusercontent.com/Ro.../master/cp.inc


Re: Organizaзгo de Interiores e VirtualWords [Entraveis] - Ryuzaki07 - 09.04.2018

Quote:
Originally Posted by VinteDois
Посмотреть сообщение
Da erro na hora de compilar, tinha abaixado a include que ele disponibilizou, da erro do mesmo jeito.