[Tutorial] Usando CallRemoteFunction [Util]
#1

Olб Amigos Forum SA:MP

Vim Trazer este Breve Tutorial para Mostra Como Se Faz Um Contato Entre um Gamemode e um Filterscript por Exemplo:

Introduзгo da Funзгo:

Estб Funзгo Tem Como Base. Pegar Dados de um Lugar e Transferi-lo. Ele Chama uma Public. Mesmo que ela Esteja Fora do Gamemode.


pawn Код:
CallRemoteFunction(const function[], const format[], {Float,_}:...)

      Explicaзгo:
                CallRemoteFunction(         // Nome da funзгo Nativa.
                const function[],           // Nome da funзгo pъblica a ser chamada Remotamente! exemplo: "MyFunction"
                const format[],             // Tag/formato de cada variбvel! exemplo: (i) sem Parкnteses.
                {Float,_}:...);             // Nъmero 'Indefinido' de argumentos de qualquer tag! exemplo:  Var_Integer
FilterScript:

pawn Код:
// Esta й uma Callback que Criamos no Filterscript (Exemplo um Sistema de Level em FS)

forward GetarLevel(playerid);
public GetarLevel(playerid) return PlayerData[playerid][Level];

//PlayerData[playerid][Level] й a Variavel que Voce usa para o Level!
//nesta callback ela retorna o valor armazenado na array PlayerData.

Gamemode:

Agora usaremos a Funзгo Criada no Filterscript :

pawn Код:
//Exemplo de um Comando que necessite que o Jogador tenha level Superior a 2:

CMD:Arma(playerid){
    if(CallRemoteFunction("GetarLevel","i",playerid) < 2) return SendClientMessage(playerid,-1,"ERRO: Seu Nivel й Inferior a 2!");}
    GivePlayerWeapon(playerid,9,1);//Exemplo Bбsico
    return 1;
}

Exemplo 2:

pawn Код:
//Exemplo o Na OnPlayerDeath. o Jogador Ganha um Nivel de Procurado. e o Servidor Manda a Seguinte Mensagem aos POLICIAIS/Cops
new string[100];
format(string, sizeof(string), "INFO COP: %s (%i) Estб Com Um Nivel de Procurado!", PlayerName(killerid), killerid);
CallRemoteFunction("MessageToCops","is",-1,string);
Agora Chamando a Callback e Mandando a Mensagem.:
pawn Код:
forward MessageToCops(color,const string[]);
public MessageToCops(color,const string[])
{
    for(new i; i < GetMaxPlayers(); i++)
    {
        if(IsPlayerConnected(i))
        {
        if (PlayerData[i][IsCop] >= 1){
        SendClientMessage(i, color, string);}
        }
       
    }
    return 1;
}

Formatos da String :

c - Insere um Caractere unico
d, i - Insere um nъmero
x - Insere numero hexadecimal
f - Insere uma Float
s - Insere uma Linha/String


Exemplo by Sa-mp Wiki :

pawn Код:
forward callMe(const string[]);
public callMe(const string[])
{
    printf("callMe> %s", string);
    return 1;
}
 
CallRemoteFunction("callMe", "s", "Linha de teste!!");

SysTeM_OFF [Nick: [EaK][_.ReBorN.__][ ] e Schocc (Por uma Ajudazinha!)


Bem и Isto..

#Breve Tutorial
Reply


Messages In This Thread
Usando CallRemoteFunction [Util] - by SeV_ - 01.07.2013, 00:29
Re: Usando CallRemoteFunction [Util] - by Gustavo_Carvalho - 01.07.2013, 00:56
Re: Usando CallRemoteFunction [Util] - by Delete_ - 01.07.2013, 01:10
Re: Usando CallRemoteFunction [Util] - by WLSF - 01.07.2013, 01:24
Re: Usando CallRemoteFunction [Util] - by Exco - 01.07.2013, 01:43
Re: Usando CallRemoteFunction [Util] - by Schocc - 01.07.2013, 01:43
Re: Usando CallRemoteFunction [Util] - by WLSF - 01.07.2013, 01:52
Re: Usando CallRemoteFunction [Util] - by SeV_ - 01.07.2013, 01:56
Re: Usando CallRemoteFunction [Util] - by Schocc - 01.07.2013, 02:08
Re: Usando CallRemoteFunction [Util] - by Suxi - 04.07.2013, 02:25

Forum Jump:


Users browsing this thread: 1 Guest(s)