[FilterScript] Debug para Criaзгo de GM
#1

Filter Script de Debug Para Criaзгo de GameModes v0.2
Crie seus GMs com mais facilidade do que nunca!

Й um simples FS que possuн os seguintes comandos:

Код:
/carro [carro] [cor1] [cor2]
/skin [skin]
/colete [colete]
/vida [vida]
/dinheiro [dinheiro]
/objeto [objeto]
/arma [arma] [balas]
/posicao
/irate [x] [y] [z]
/ir [id]
/trazer [id]
/pm [id] [texto]
/loadfs [nome fs]
/reloadfs [nome fs]
/unloadfs [nome fs]
/salvarveh
/carregarvehs

/comandos
Funзхes:
- Lista de comandos em dialog.
- Comandos zcmd + sscanf.
- Quando vocк clica no mapa й teleportado para onde vocк clicou.
- Salvamento e carregamentos de veнculos.

Agradecimentos:

- Todos que postaram sugestхes aqui no tуpico

Crйditos:

****** - sscanf (https://sampforum.blast.hk/showthread.php?tid=120356)
Zeex - zcmd (https://sampforum.blast.hk/showthread.php?tid=91354)
SA:MP Team - gl_common.inc
[iPs]Victor - FilterScript

Download:

pawn Код:
#include <a_samp>

#include <zcmd>
#include <sscanf2>

#include "../include/gl_common.inc"

#define fVEICULOS "VeiculosDebug/veiculos.txt"

#define VER "0.2"

#if defined CreditosDebug
 #undef CreditosDebug
#endif

#if defined CreditosDebug

---------------------------------------------------------------------------------------------------------

                            FilterScript de Debug para Criaзгo de GameModes

-> ****** - sscanf
-> Zeex - zcmd
-> SA:MP Team - gl_common.inc
-> [iPs]Victor - FilterScript

---------------------------------------------------------------------------------------------------------

#endif

public OnFilterScriptInit()
{
    printf(">> FilterScript de Debug para Criaзгo de GameModes carregado. Versao %s\n", VER);
    return 1;
}

public OnFilterScriptExit()
{
    printf(">> FilterScript de Debug para Criaзгo de GameModes descarregado. Versao %s\n", VER);
    return 1;
}

public OnPlayerClickMap(playerid, Float:fX, Float:fY, Float:fZ)
{
    SetPlayerPosFindZ(playerid, fX, fY, fZ);
    cmd_posicao(playerid, "");
    return 1;
}

static  iID,
        szNome[24],
        szString[128],
        szString2[128],
        szString3[1024],
        wname[64],
        iVar1,
        iVar2,
        iVar3,
        Float:fVar1,
        Float:fVar2,
        Float:fVar3,
        Float:fpX[MAX_PLAYERS],
        Float:fpY[MAX_PLAYERS],
        Float:fpZ[MAX_PLAYERS],
        Float:fpA[MAX_VEHICLES],
        iVColor1[MAX_VEHICLES],
        iVColor2[MAX_VEHICLES];

#define SendClientMessageEx(%0,%1,%2,%3)        format(szString, sizeof szString, %2, %3);\
                                                SendClientMessage(%0, %1, szString)

#define SendClientMessageToAllEx(%0,%1,%2)      format(szString, sizeof szString, %1, %2);\
                                                SendClientMessageToAll(%0, szString)

#define SendRconCommandEx(%0,%1)                format(szString, sizeof szString, %0, %1);\
                                                SendRconCommand(szString)
                                               
#pragma unused iVar3
                                               

CMD:comandosdebug(playerid, params[])
{
    #pragma unused params
    static cmds1[] =    "{DADADA}/carro {FFFFFF}[carro] [cor1] [cor2]\n\
                        {FFFFFF}/skin {FFFFFF}[skin]\n\
                        {DADADA}/colete {FFFFFF}[colete]\n\
                        {FFFFFF}/vida {FFFFFF}[vida]\n\
                        {DADADA}/dinheiro {FFFFFF}[dinheiro]\n\
                        {FFFFFF}/objeto {FFFFFF}[objeto]\n\
                        {DADADA}/arma {FFFFFF}[arma] [balas]\n"
;

    static cmds2[] =    "{FFFFFF}/posicao\n\
                        {DADADA}/irate {FFFFFF}[x] [y] [z]\n\
                        {FFFFFF}/ir {FFFFFF}[id]\n\
                        {DADADA}/trazer {FFFFFF}[id]\n\
                        {FFFFFF}/pm {FFFFFF}[id] [texto]\n\
                        {DADADA}/loadfs {FFFFFF}[nome fs]\n\
                        {FFFFFF}/reloadfs {FFFFFF}[nome fs]\n\
                        {DADADA}/unloadfs {FFFFFF}[nome fs]\n\
                        {FFFFFF}/savarveh\n\
                        {DADADA}/carregarvehs\n"
;
                       
    format(szString3, sizeof szString3, "%s%s", cmds1, cmds2);
    ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Comandos Debug", szString3 , "Ok", "");
   
    return 1;
}

CMD:carro(playerid, params[])
{
    if(sscanf(params, "ddd", iID, iVar1, iVar2))
        return SendClientMessage(playerid, -1, "{FF0000}Use: /carro [modelo] [cor1] [cor2]");
       
    GetPlayerPos(playerid, fpX[playerid], fpY[playerid], fpZ[playerid]);

    CreateVehicle(iID, fpX[playerid], fpY[playerid], fpZ[playerid], 90.0, iVar1, iVar2, -1);
   
    SendClientMessageEx(playerid, -1, "{CCCCCC}Vocк criou o carro %d!", iID);
    return 1;
}

CMD:skin(playerid, params[])
{
    if(sscanf(params, "d", iID))
        return SendClientMessage(playerid, -1, "{FF0000}Use: /skin [skin]");

    SetPlayerSkin(playerid, iID);
   
    SendClientMessageEx(playerid, -1, "{CCCCCC}Vocк pegou a skin %d!", iID);
    return 1;
}

CMD:vida(playerid, params[])
{
    if(sscanf(params, "f", fVar1))
        return SendClientMessage(playerid, -1, "{FF0000}Use: /vida [vida]");

    SetPlayerHealth(playerid, fVar1);
   
    SendClientMessageEx(playerid, -1, "{CCCCCC}Vocк pegou %f de vida!", fVar1);
    return 1;
}

CMD:colete(playerid, params[])
{
    if(sscanf(params, "f", fVar1))
        return SendClientMessage(playerid, -1, "{FF0000}Use: /colete [colete]");

    SetPlayerArmour(playerid, fVar1);
   
    SendClientMessageEx(playerid, -1, "{CCCCCC}Vocк pegou %f de colete!", fVar1);
    return 1;
}

CMD:dinheiro(playerid, params[])
{
    if(sscanf(params, "d", iVar1))
        return SendClientMessage(playerid, -1, "{FF0000}Use: /dinheiro [dinheiro]");

    GivePlayerMoney(playerid, iVar1);
   
    SendClientMessageEx(playerid, -1, "{CCCCCC}Vocк pegou $%d!", iVar1);
    return 1;
}

CMD:objeto(playerid, params[])
{
    if(sscanf(params, "d", iID))
        return SendClientMessage(playerid, -1, "{FF0000}Use: /objeto [modelo]");

    GetPlayerPos(playerid, fpX[playerid], fpY[playerid], fpZ[playerid]);

    CreateObject(iID, fpX[playerid], fpY[playerid], fpZ[playerid], 0.0, 0.0, 0.0);
   
    SetPlayerPos(playerid, fpX[playerid], fpY[playerid], fpZ[playerid] + 5.0);
   
    SendClientMessageEx(playerid, -1, "{CCCCCC}Vocк criou o objeto %d!", iID);
    return 1;
}

CMD:arma(playerid, params[])
{
    if(sscanf(params, "dd", iID, iVar1))
        return SendClientMessage(playerid, -1, "{FF0000}Use: /arma [arma] [balas]");

    GivePlayerWeapon(playerid, iID, iVar1);
    GetWeaponName(iID, wname, sizeof wname);
   
    SendClientMessageEx(playerid, -1, "{CCCCCC}Vocк pegou a arma %s com %d balas!", wname, iVar1);
    return 1;
}

CMD:posicao(playerid, params[])
{
    #pragma unused params
    GetPlayerPos(playerid, fpX[playerid], fpY[playerid], fpZ[playerid]);

    SendClientMessageEx(playerid, -1, "{CCCCCC}Sua posiзгo й: X%0.2f Y%0.2f Z%0.2f", fpX[playerid], fpY[playerid], fpZ[playerid]);
    return 1;
}

CMD:irate(playerid, params[])
{
    if(sscanf(params, "fff", fVar1, fVar2, fVar3))
        return SendClientMessage(playerid, -1, "{FF0000}Use: /irate [x] [y] [z]");

    SetPlayerPos(playerid, fVar1, fVar2, fVar3);
   
    SendClientMessageEx(playerid, -1, "{CCCCCC}Vocк foi atй: X%f Y%f Z%f", fVar1, fVar2, fVar3);
    return 1;
}

CMD:ir(playerid, params[])
{
    if(sscanf(params, "d", iID))
        return SendClientMessage(playerid, -1, "{FF0000}Use: /ir [playerid]");

    GetPlayerPos(playerid, fpX[iID], fpY[iID], fpZ[iID]);
   
    if(!IsPlayerInAnyVehicle(playerid)) SetPlayerPos(playerid, fpX[iID], fpY[iID], fpZ[iID]);
    else SetVehiclePos(GetPlayerVehicleID(playerid), fpX[iID], fpY[iID], fpZ[iID]);
   
    SendClientMessageEx(iID, -1, "{CCCCCC}%s foi atй sua posiзгo!", GetPlayerNameEx(playerid));
    SendClientMessageEx(playerid, -1, "{CCCCCC}Vocк foi atй a posiзгo de %s!", GetPlayerNameEx(iID));
   
    return 1;
}

CMD:trazer(playerid, params[])
{
    if(sscanf(params, "d", iID))
        return SendClientMessage(playerid, -1, "{FF0000}Use: /trazer [playerid]");

    GetPlayerPos(playerid, fpX[playerid], fpY[playerid], fpZ[playerid]);

    if(!IsPlayerInAnyVehicle(iID)) SetPlayerPos(iID, fpX[playerid], fpY[playerid], fpZ[playerid]);
    else SetVehiclePos(GetPlayerVehicleID(iID), fpX[playerid], fpY[playerid], fpZ[playerid]);
   
    SendClientMessageEx(iID, -1, "{CCCCCC}%s levou vocк atй sua posiзгo!", GetPlayerNameEx(playerid));
    SendClientMessageEx(playerid, -1, "{CCCCCC}Vocк %s levou atй sua posiзгo!", GetPlayerNameEx(iID));
   
    return 1;
}

CMD:pm(playerid, params[])
{
    if(sscanf(params, "is", iID, szString2))
        return SendClientMessage(playerid, -1, "{FF0000}Use: /pm [id] [texto]");
       
    SendClientMessageEx(iID, -1, "{CCCCCC}[Recebido] PM %s: {FFFFFF}%s",GetPlayerNameEx(playerid), szString2);
    SendClientMessageEx(playerid, -1, "{CCCCCC}[Enviado] PM %s: {FFFFFF}%s",GetPlayerNameEx(iID), szString2);
    return 1;
}

CMD:loadfs(playerid, params[])
{
    if(sscanf(params, "s", szString2))
        return SendClientMessage(playerid, -1, "{FF0000}Use: /loadfs [fs nome]");

    SendRconCommandEx("loadfs %s", szString2);
    return 1;
}

CMD:reloadfs(playerid, params[])
{
    if(sscanf(params, "s", szString2))
        return SendClientMessage(playerid, -1, "{FF0000}Use: /reloadfs [fs nome]");

    SendRconCommandEx("reloadfs %s", szString2);
    return 1;
}

CMD:unloadfs(playerid, params[])
{
    if(sscanf(params, "s", szString2))
        return SendClientMessage(playerid, -1, "{FF0000}Use: /unloadfs [fs nome]");

    SendRconCommandEx("unloadfs %s", szString2);
    return 1;
}

CMD:carregarvehs(playerid, params[])
{
    #pragma unused params
   
    LoadStaticVehiclesFromFile(fVEICULOS);
   
    SendClientMessage(playerid, -1, "{CCCCCC}[Carregar] Veнculos carregados com sucesso!");
    return 1;
}

CMD:salvarveh(playerid, params[])
{
    #pragma unused params
   
    GetPlayerPos(playerid, fpX[playerid], fpY[playerid], fpZ[playerid]);
    GetVehicleZAngle(GetPlayerVehicleID(playerid), fpA[GetPlayerVehicleID(playerid)]);

    format(szString3, sizeof szString3, "%d,%f,%f,%f,%f,%d,%d\n",
                                        GetVehicleModel(GetPlayerVehicleID(playerid)),
                                        fpX[playerid], fpY[playerid], fpZ[playerid],
                                        fpA[playerid],
                                        iVColor1[GetPlayerVehicleID(playerid)],
                                        iVColor2[GetPlayerVehicleID(playerid)] );

    new File:arq = fopen(fVEICULOS, io_append);
    fwrite(arq, szString3);
    fclose(arq);

    SendClientMessage(playerid, -1, "{CCCCCC}[Salvar] Veiculo salvo com sucesso!");
    return 1;
}


public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
    iVColor1[vehicleid] = color1;
    iVColor2[vehicleid] = color2;
    return 1;
}

static stock GetPlayerNameEx(p)
{
    GetPlayerName(p, szNome, sizeof szNome);
    return szNome;
}

Код:
Change Log:

0.2
- Adicionada funзгo de criaзгo e salvamento de veнculos.
- Corrigidos erros mнnimos de script.
- Adicionado SetPlayerPosFindZ no OnPlayerClickMap
#obs: /irate jб tinha (muitos pediram /irpos )
Reply
#2

Oh god, WHY I never thought about it

Cara, ta guardadinho aqui :*

Realmente, no comeзo do mode tu fica numa falta lazarenta de comandos, isso ja quebra um galho xD

@edit

Falto um /irpos xD
Reply
#3

Уtimo.

Usa SetPlayerPosFindZ no OnPlayerClickMap
Reply
#4

Simples mais muito util, bom trabalho!
Reply
#5

pawn Код:
#if defined CreditosDebug
 #undef CreditosDebug
#endif

#if defined CreditosDebug

---------------------------------------------------------------------------------------------------------

                            FilterScript de Debug para Criaзгo de GameModes

-> ****** - sscanf
-> Zeex - zcmd
-> [iPs]Victor - FilterScript

---------------------------------------------------------------------------------------------------------

#endif
Oi?? wtf?
Bom trab.
Reply
#6

Muito massa

@OFF

Que bonitinho, todos membros da IPS, com R, P , V nos avatars *-*
Reply
#7

Acho que faltou /* /* no inicio.
Reply
#8

Ficou bom, mas achei estes erros aqui. :P

pawn Код:
---------------------------------------------------------------------------------------------------------

                            FilterScript de Debug para Criaзгo de GameModes

-> ****** - sscanf
-> Zeex - zcmd
-> [iPs]Victor - FilterScript

---------------------------------------------------------------------------------------------------------

#endif


CMD:arma(playerid, params[])
{
    if(sscanf(params, "ddd", iID, iVar1))
        return SendClientMessage(playerid, -1, "{FF0000}Use: /arma [arma] [balas]");

    GivePlayerWeapon(playerid, iID, iVar1);
    GetWeaponName(iID, wname, sizeof wname);
   
    SendClientMessageEx(playerid, -1, "{CCCCCC}Vocк pegou a arma %s com %d balas!", wname, iVar1);
    return 1;
}

// -- ------

CMD:skin(playerid, params[])
{
    if(sscanf(params, "dd", iID))
        return SendClientMessage(playerid, -1, "{FF0000}Use: /skin [skin]");

    SetPlayerSkin(playerid, iID);
   
    SendClientMessageEx(playerid, -1, "{CCCCCC}Vocк pegou a skin %d!", iID);
    return 1;
}
Reply
#9

Bom Trabalho
Reply
#10

Legal!

@Matheus

Eu nгo estou... Hehe!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)