[DUV] Minhas Duvidas !
#9

a segunda questao:

pawn Код:
#include <dudb>

new
    VehicleNames[212][] =
{
    "Landstalker",
    "Bravura",
    "Buffalo",
    "Linerunner",
    "Pereniel",
    "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",
    "Previon",
    "Coach",
    "Cabbie",
    "Stallion",
    "Rumpo",
    "RC-Bandit",
    "Romero",
    "Packer",
    "Monster",
    "Admiral",
    "Squalo",
    "Seasparrow",
    "Pizzaboy",
    "Tram",
    "Trailer",
    "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",
    "ZR3-50",
    "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",
    "Hotring-Racer",
    "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",
    "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",
    "Trailer",
    "Kart",
    "Mower",
    "Duneride",
    "Sweeper",
    "Broadway",
    "Tornado",
    "AT-400",
    "DFT-30",
    "Huntley",
    "Stafford",
    "BF-400",
    "Newsvan",
    "Tug",
    "Trailer",
    "Emperor",
    "Wayfarer",
    "Euros",
    "Hotdog",
    "Club",
    "Trailer-B",
    "Trailer-C",
    "Andromada",
    "Dodo",
    "RC-CaLm",
    "Launch",
    "Police Car [LSPD]",
    "Police Car [SFPD]",
    "Police Car [LVPD]",
    "Police Ranger",
    "Picador",
    "S.W.A.T",
    "Alpha",
    "Phoenix",
    "Glendale",
    "Sadler",
    "Luggage Trailer",
    "Luggage Trailer",
    "Stair Trailer",
    "Boxville",
    "Farm Plow",
    "Utility Trailer"
};

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

    cmd = strtok(cmdtext, idx);

    if (strcmp("/createcar", cmd, true, 10) == 0)
    {
        new
            ida;
        tmp = strtok(cmdtext,idx);
        if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xAA3333AA, "Uso: /createcar [Nome/ID]");
        if(!IsNumeric(tmp)) ida = GetVehicleModelIDFromName(tmp); else ida = strval(tmp);
        if(ida < 400 || ida > 603) return SendClientMessage(playerid ,0xAA3333AA,"Modelo Invalido");
        CreatePlayerVehicle(playerid, ida);
        return 1;
    }
    return 1;
}

stock
    CreatePlayerVehicle( playerid, modelid )
{
    new
        vehicle,
        Float:xa,
        Float:ya,
        Float:za,
        Float:xa2,
        Float:ya2,
        Float:za2,
        Float:anglea;

    if ( GetPlayerState( playerid ) == PLAYER_STATE_DRIVER )
    {
        vehicle = GetPlayerVehicleID( playerid );
        GetVehiclePos( vehicle, xa, ya, za );
        GetVehicleZAngle( vehicle, anglea );
        GetVehicleVelocity(vehicle,xa2,ya2,za2);
        DestroyVehicle( vehicle );
    }
    else
    {
        GetPlayerPos( playerid, xa, ya, za );
        GetPlayerFacingAngle( playerid, anglea );
    }
    vehicle = AddStaticVehicle( modelid, xa, ya, ( za + 1 ), anglea,-1,-1);
    LinkVehicleToInterior( vehicle, GetPlayerInterior( playerid ) );
    SetVehicleVirtualWorld( vehicle, GetPlayerVirtualWorld( playerid ) );
    PutPlayerInVehicle( playerid, vehicle, 0 );
    PlayerPlaySound(playerid,1133,0,0,0);
    SetVehicleVelocity(vehicle,xa2,ya2,za2);
    return 1;
}

IsNumeric(const stringf[])
{
    for (new g = 0, kho = strlen(stringf); g < kho; g++)
    {
        if (stringf[g] > '9' || stringf[g] < '0') return 0;
    }
    return 1;
}

GetVehicleModelIDFromName(vname[])
{
    for(new i = 0; i < 211; i++)
    {
        if ( strfind(VehicleNames[i], vname, true) != -1 )
        return i + 400;
    }
    return -1;
}
ja agora para criar o carro podes fazer /createcar phoenix por exemplo ou /createcar 603

a 4 questao:

vai aqui: http://forum.sa-mp.com/showthread.ph...ghlight=speedo

aproveita so a parte de ligar o motor e desligar se quiseres...

a ultima questao metes no onplayerconnect
pawn Код:
if(!IsPlayerNPC(playerid))
    {
        new
            name[24];
        GetPlayerName(playerid, name, sizeof(name));
        CheckRPName(playerid,name);
    }
//no fundo do script...
stock CheckRPName(playerid, name[])
{
    new ch = name[0];
    if(strfind(name, "_") != -1)
    {
        if(ch >= 'A' && ch <= 'Z')
        {
            for(new i=0, j=strlen(name); i < j; i++)
            {
                if((name[i] >= 0) && (name[i] <= 9))
                {
                    SendClientMessage(playerid, 0xF60000AA, "[Erro:] O teu nome nao pode conter numeros!");
                    Kick(playerid);
                    return 0;
                }
                if(!strfind(name[i], "_"))
                {
                    name[++i];
                    if(name[i] >= 'A' && name[i] <= 'Z') return 1;
                    else
                    {
                        SendClientMessage(playerid, 0xF60000AA, "[Erro:] O teu ultimo nome deve comeзar com letra maiuscula!");
                        Kick(playerid);
                        return 0;
                    }
                }
                else continue;
            }
            return 1;
        }
        else
        {
            SendClientMessage(playerid, 0xF60000AA, "[Erro:] O teu Primeiro nome deve comeзar com letra maiuscula!");
            Kick(playerid);
            return 0;
        }
    }
    else
    {
        SendClientMessage(playerid, 0xF60000AA, "[Erro:] Entre os nomes deve de ter o caracter _");
        Kick(playerid);
        return 0;
    }
}
Reply


Messages In This Thread
[DUV] Minhas Duvidas ! - by Baddark2131 - 31.07.2010, 23:50
Re: [DUV] Minhas Duvidas ! - by Lucca_dias - 01.08.2010, 00:03
Re: [DUV] Minhas Duvidas ! - by Baddark2131 - 01.08.2010, 01:40
Re: [DUV] Minhas Duvidas ! - by [NWD]Tweener_ - 01.08.2010, 01:47
Re: [DUV] Minhas Duvidas ! - by pawNO - 01.08.2010, 18:11
Re: [DUV] Minhas Duvidas ! - by Baddark2131 - 03.08.2010, 23:29
Re: [DUV] Minhas Duvidas ! - by zSuYaNw - 03.08.2010, 23:45
Re: [DUV] Minhas Duvidas ! - by Marco_Nutz - 04.08.2010, 00:14
Re: [DUV] Minhas Duvidas ! - by SlashPT - 04.08.2010, 07:00
Re: [DUV] Minhas Duvidas ! - by Falcon. - 04.08.2010, 16:33

Forum Jump:


Users browsing this thread: 2 Guest(s)