[AJUDA] strock em sscaf
#1

Gente, Bom dia a Todos

Bom Achei um Fs Muito bom ( Creditos total ao Fs para [NWD]Jim._.Carrey )
So que Esta em Fs, Estou tentando passar para o Gm para colocar a variavel onde so admin pudesse criar veiculo.

Admin tipo, Moderador, Administrador e nao sу Administrador Rcon

Tem Como passa Para o Gm ? as Classificaзхes de Admin й 1000 й Moderador e 2000 e Administrador

Obrigado Gente.

ta Aqui o Sistema, Tentei Ler um Tuto na Net Mas Nao conseguir :P


pawn Код:
#include <a_samp>

new
    Modelo[MAX_PLAYERS]
;
new
    g_string[128]
;
new
    Float:PlayerGetPos[3]
;
new
    VeiculoID[MAX_PLAYERS]
;
new
    Text3D:VLabel3D[MAX_PLAYERS]
;
new
    bool:CriouVeiculo[MAX_PLAYERS]
;

enum veiculospp
{
    Nome[20]
}
new Veiculopp[MAX_VEHICLES][veiculospp];

new Veiculos[212][] =
{
    {"Landstalker"},{"Bravura"},{"Buffalo"},{"Linerunner"},{"Perrenial"},{"Sentinel"},{"Dumper"},{"Firetruck"},{"Trashmaster"},
    {"Stretch"},{"Manana"},{"Infernus"},{"Voodoo"},{"Pony"},{"Mule"},{"Cheetah"},{"Ambulance"},{"Leviathan"},{"Moonbeam"},
    {"Esperanto"},{"Taxi"},{"Washington"},{"Bobcat"},{"Mr Whoopee"},{"BF Injection"},{"Hunter"},{"Premier"},{"Enforcer"},
    {"Securicar"},{"Banshee"},{"Predator"},{"Bus"},{"Rhino"},{"Barracks"},{"Hotknife"},{"Trailer 1"},{"Previon"},{"Coach"},
    {"Cabbie"},{"Stallion"},{"Rumpo"},{"RC Bandit"},{"Romero"},{"Packer"},{"Monster"},{"Admiral"},{"Squalo"},{"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"},{"Sandking"},{"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"},{"Roadtrain"},{"Nebula"},
    {"Majestic"},{"Buccaneer"},{"Shamal"},{"Hydra"},{"FCR-900"},{"NRG-500"},{"HPV1000"},{"Cement Truck"},{"Tow Truck"},{"Fortune"},
    {"Cadrona"},{"FBI Truck"},{"Willard"},{"Forklift"},{"Tractor"},{"Combine"},{"Feltzer"},{"Remington"},{"Slamvan"},{"Blade"},
    {"Freight"},{"Streak"},{"Vortex"},{"Vincent"},{"Bullet"},{"Clover"},{"Sadler"},{"Firetruck LA"},{"Hustler"},{"Intruder"},
    {"Primo"},{"Cargobob"},{"Tampa"},{"Sunrise"},{"Merit"},{"Utility"},{"Nevada"},{"Yosemite"},{"Windsor"},{"Monster A"},{"Monster B"},
    {"Uranus"},{"Jester"},{"Sultan"},{"Stratum"},{"Elegy"},{"Raindance"},{"RC Tiger"},{"Flash"},{"Tahoma"},{"Savanna"},{"Bandito"},
    {"Freight Flat"},{"Streak Carriage"},{"Kart"},{"Mower"},{"Duneride"},{"Sweeper"},{"Broadway"},{"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"}
};

public OnPlayerConnect(playerid)
{
    VeiculoID[playerid] = -1;
    CriouVeiculo[playerid] = false;
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    DestroyVehicle(VeiculoID[playerid]);
    VeiculoID[playerid] = -1;
    CriouVeiculo[playerid] = false;
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    new
        cmd[128], idx, tmp[128];

    cmd = strtok(cmdtext, idx);
   
    GetPlayerPos(playerid, PlayerGetPos[0], PlayerGetPos[1], PlayerGetPos[2]);
    new
        Float:iAngulo
    ;
    GetPlayerFacingAngle(playerid, iAngulo);

    if(strcmp(cmd, "/cv", true) == 0 || strcmp(cmd, "/criarveiculo", true) == 0)
    {

        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, 0xFF3300AA, "[x] Uso correto: /cv [id] [cor-1] [cor-2]");
            return 1;
        }
        new veiculo = GetVehicleModelID(tmp);
        if(veiculo == -1)
        {
            veiculo = strval(tmp);
            if(veiculo < 400 || veiculo > 611)
            {
                SendClientMessage(playerid, 0xFF3300AA, "[x] Uso correto: /cv [id] [cor-1] [cor-2");
                return 1;
            }
        }
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, 0xFF3300AA, "[x] Uso correto: /cv [id] [cor-1] [cor-2");
            return 1;
        }
        new color1 = strval(tmp);
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, 0xFF3300AA, "[x] Uso correto: /cv [id] [cor-1] [cor-2");
            return 1;
        }
        new color2 = strval(tmp);
        if(veiculo < 400 || veiculo > 611)
        {
            SendClientMessage(playerid, 0xFF3300AA, "[x] Somente veнculos entre 400 б 611!");
            return 1;
        }
        DestroyVehicle(VeiculoID[playerid]);
        PutPlayerInVehicle(playerid, Modelo[ playerid ] = CreateVehicle(veiculo, PlayerGetPos[0], PlayerGetPos[1], PlayerGetPos[2], iAngulo, color1, color2, -1), 0);
        VeiculoID[playerid] = GetPlayerVehicleID(playerid);
        CriouVeiculo[playerid] = true;
        format(g_string, sizeof(g_string), "[INFO] %s criado com sucesso! (Somente vocк pode dirigi-lo)", Veiculos[GetVehicleModel(Modelo[ playerid ])-400]);
        SendClientMessage(playerid, 0xFFFF33AA, g_string);
        format(g_string, sizeof(g_string), "%s [%d]", PlayerName(playerid), playerid);
        VLabel3D[playerid] = Create3DTextLabel(g_string, 0x00FF00AA, 0.0, 0.0, 0.0, 40.0, 0, 1);
        Attach3DTextLabelToVehicle(VLabel3D[playerid], Modelo[ playerid ], 0.0, -2.5, 0.5);
        format(Veiculopp[VeiculoID[playerid]][Nome], 20, PlayerName(playerid));
        return 1;
    }
    if(strcmp(cmd, "/vtrazer", true) == 0)
    {
        if(CriouVeiculo[playerid] == true)
        {
            SendClientMessage(playerid, 0xCCFF33AA, "[x] Vocк trouxe seu veнculo atй vocк.");
            GetPlayerPos(playerid, PlayerGetPos[0], PlayerGetPos[1], PlayerGetPos[2]);
            SetVehiclePos(VeiculoID[playerid], PlayerGetPos[0], PlayerGetPos[1], PlayerGetPos[2]+1);
            SetVehicleZAngle(VeiculoID[playerid], iAngulo);
            PutPlayerInVehicle(playerid, VeiculoID[playerid], 0);
            return 1;
        }
        else
        {
            SendClientMessage(playerid, 0xFF6633AA, "[x] Vocк nгo criou um veнculo prуprio para vocк!");
            return 1;
        }
    }
    return 0;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
    if(GetPlayerVehicleID(playerid) == VeiculoID[playerid])
    {
        if(strcmp(Veiculopp[GetPlayerVehicleID(playerid)][Nome], PlayerName(playerid), true) == 0)
        {
            format(g_string, sizeof(g_string), ".: %s [%d] :.", PlayerName(playerid), playerid);
            Update3DTextLabelText(VLabel3D[playerid], -1, g_string);
        }
    }
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
        if(strcmp(Veiculopp[GetPlayerVehicleID(playerid)][Nome], PlayerName(playerid), false))
        {
            format(g_string, sizeof(g_string), "[x] Veнculo prуprio do(a) %s somente ele(a) pode dirigi-lo!", Veiculopp[GetPlayerVehicleID(playerid)][Nome]);
            SendClientMessage(playerid, 0xFF6633AA, g_string);
            PlayerPlaySound(playerid, 1147, 0.0, 0.0, 0.0);
            RemovePlayerFromVehicle(playerid);
        }
        else
        {
            Update3DTextLabelText(VLabel3D[playerid], -1, "  ");
        }
        return 1;
    }
    return 1;
}

stock 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 GetVehicleModelID(nome[])
{
    for(new i = 0; i < 211; ++i)
    {
        if(strfind(Veiculos[i], nome, true) != -1) return i + 400;
    }
    return -1;
}

stock PlayerName(playerid)
{
    new
        PvName[MAX_PLAYER_NAME+1]
    ;
    GetPlayerName(playerid, PvName, sizeof(PvName));
    return PvName;
}
Reply
#2

Nem precisava passar para o gamemode, vocк poderia criar uma callback no seu gamemode que retornasse a var admin! e nesse filterscript bastava vocк utilizar CallRemoteFunction ex:

No gamemode:
pawn Код:
forward GetPlayerAdminLevel(playerid);
public GetPlayerAdminLevel(playerid) {
    return VarAdmin;
}
No Filterscript:
pawn Код:
if(CallRemoteFunction("GetPlayerAdminLevel","i",playerid) < 2000) return SendClientMessage(playerid, 0xFF0000FF,"[ERRO]: Vocк nгo tem permissгo para isso!");
Tambйm
Reply
#3

Bom No Fs Compilou Sem Erros

No gm Deu um Erro

pawn Код:
Compilando BCV.pwn...
C:\Documents and Settings\Murilo de sousa\Desktop\Brasil City Virtual [RPG] Giant World №.°\gamemodes\BCV.pwn(2704) : error 017: undefined symbol "VarAdmin"

Pawn compiler 3.2.3664                          Copyright (c) 1997-2006, ITB CompuPhase
#EDIT: Defini o VarAdmin: new VarAdmin; Mas Nao sei o Valor que coloco Na Definiзao para Funcionar.

Assim Dara Certo ? P.s Indo testar ...
Reply
#4

Quote:
Originally Posted by Murilo_sousa
Посмотреть сообщение
Bom No Fs Compilou Sem Erros

No gm Deu um Erro

pawn Код:
Compilando BCV.pwn...
C:\Documents and Settings\Murilo de sousa\Desktop\Brasil City Virtual [RPG] Giant World №.°\gamemodes\BCV.pwn(2704) : error 017: undefined symbol "VarAdmin"

Pawn compiler 3.2.3664                          Copyright (c) 1997-2006, ITB CompuPhase
Simbolo nгo estб definido, Provavelmente й isso no topo do GM:

pawn Код:
new VarAdmin[MAX_PLAYERS];
@Edit - Pode ser Definido pela enum Tambйm.
Reply
#5

Posta qualquer comando de administrador aqui!
Reply
#6

Quote:
Originally Posted by .FuneraL.
Посмотреть сообщение
Simbolo nгo estб definido, Provavelmente й isso no topo do GM:

pawn Код:
new VarAdmin[MAX_PLAYERS];
@Edit - Pode ser Definido pela enum Tambйm.
Hun ..

Seu eu Defino Apenas Assim: new VarAdmin; << Nao da Erro

Mas Se Eu Defino Assim: new VarAdmin[MAX_PLAYERS]; << Da um Erro

pawn Код:
Compilando BCV.pwn...
C:\Documents and Settings\Murilo de sousa\Desktop\Brasil City Virtual [RPG] Giant World №.°\gamemodes\BCV.pwn(2705) : error 090: public functions may not return arrays (symbol "GetPlayerAdminLevel")

Pawn compiler 3.2.3664                          Copyright (c) 1997-2006, ITB CompuPhase
o Mlk pediu um cmd de Admin ta Aqui:

pawn Код:
CMD:a(playerid, params[])
{
    new String4[128];
    if(PlayerInfo[playerid][pAdmin] < 2000) return SendClientMessage(playerid, VERMELHO_ESCURO, "Vocк nгo tem autorizaзгo!");
    if(sscanf(params, "s[128]", String4)) return SendClientMessage(playerid, VERMELHO_ESCURO, "[x] Uso Correto: /a [Texto]");

    GetPlayerName(playerid, Nome, sizeof(Nome));
    format(String4, sizeof(String4), "(ADM) %s: %s", Nome, String4);
    SendClientMessageToAll(AZUL_CLARO_2, String4);

    return 1;
}
Reply
#7

Vocкs nгo me entederam! no lugar da variavel "Varadmin" ele precisa colocar a var admin do gamemode dele! Poste qualquer comando de administrador para eu ver!
@EDIT
pawn Код:
forward GetPlayerAdminLevel(playerid);
public GetPlayerAdminLevel(playerid) {
    return PlayerInfo[playerid][pAdmin];
}
Reply
#8

Quote:
Originally Posted by RoacH`
Посмотреть сообщение
Vocкs nгo me entederam! no lugar da variavel "Varadmin" ele precisa colocar a var admin do gamemode dele! Poste qualquer comando de administrador para eu ver!
@EDIT
pawn Код:
forward GetPlayerAdminLevel(playerid);
public GetPlayerAdminLevel(playerid) {
    return PlayerInfo[playerid][pAdmin];
}
Obrigado Deu Certo +rep

й Nozes Vlw ai Voces Me ajudam Bastante
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)