[AJUDA] Novo bug no /forcartutorial
#7

tenta isso: copiei dos codigos uteis, eh um fs inteiro:
pawn Код:
#include <a_samp>
#include <dudb>

#pragma unused ret_memcpy

new
    IsOccupied[MAX_VEHICLES]
;

public OnGameModeInit()
{
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    return 1;
}

public OnGameModeExit()
{
    return 1;
}

main()
    print("test");

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 OnPlayerRequestClass(playerid, classid)
{
    return 1;
}

public OnPlayerConnect(playerid)
{
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    return 1;
}

public OnPlayerSpawn(playerid)
{
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    IsOccupied[vehicleid] = 0;
    return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
    IsOccupied[vehicleid] = 0;
    return 1;
}

public OnPlayerText(playerid, text[])
{
    return 1;
}

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;
    }
    if (strcmp("/destroy1", cmd, true, 10) == 0)
    {
        ResetarVeiculos();
        return 1;
    }
    if (strcmp("/destroy2", cmd, true, 10) == 0)
    {
        ResetarVeiculos2();
        return 1;
    }
    return 1;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    IsOccupied[vehicleid] = 1;
    return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
    IsOccupied[vehicleid] = 0;
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
    return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
    return 1;
}

public OnRconCommand(cmd[])
{
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    return 1;
}

public OnObjectMoved(objectid)
{
    return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
    return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
    return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
    return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
    return 1;
}

public OnPlayerExitedMenu(playerid)
{
    return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
    return 1;
}

public OnPlayerUpdate(playerid)
{
    return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
    return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
    return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
    return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    return 1;
}

stock
    CreatePlayerVehicle(playerid, modelid)
{
    new
        vehicle,
        Float:pos[4]
    ;

    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        vehicle = GetPlayerVehicleID(playerid);
        GetVehiclePos(vehicle, pos[0], pos[1], pos[2]);
        GetVehicleZAngle(vehicle, pos[3]);
        DestroyVehicle(vehicle);
    }
    else
    {
        GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
        GetPlayerFacingAngle(playerid, pos[3]);
    }
    vehicle = AddStaticVehicle( modelid, pos[0], pos[1], (pos[2] + 1),pos[3],-1,-1);
    LinkVehicleToInterior(vehicle, GetPlayerInterior(playerid));
    SetVehicleVirtualWorld(vehicle, GetPlayerVirtualWorld(playerid));
    PlayerPlaySound(playerid,1133,0,0,0);
    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;
}

stock ResetarVeiculos()
{
    new
        time = GetTickCount()
    ;
    for( new j = 0; j < MAX_VEHICLES; j++)
    {
        for( new p = 0; p < MAX_PLAYERS; p++)
        if(!IsPlayerInVehicle(p,j))
        {
            SetVehicleToRespawn(j);
        }
    }
    printf("Tick Count 1: %d",(GetTickCount() - time)*100000);
    return 1;
}

stock ResetarVeiculos2()
{
    new
        time = GetTickCount()
    ;
    for( new j = 0; j < MAX_VEHICLES; j++)
    {
        if(IsOccupied[j] == 0)
        {
            SetVehicleToRespawn(j);
        }
    }
    printf("Tick Count 2: %d",(GetTickCount() - time)*100000);
    return 1;
}
Creditos pro Dark Team PT
Reply


Messages In This Thread
[AJUDA] Novo bug no /forcartutorial - by Marco_Nutz - 12.08.2010, 23:26
Re: [AJUDA] Novo bug no /forcartutorial - by [Michael] - 12.08.2010, 23:41
Re: [AJUDA] Novo bug no /forcartutorial - by Marco_Nutz - 12.08.2010, 23:43
Re: [AJUDA] Novo bug no /forcartutorial - by ipsBruno - 13.08.2010, 01:02
Re: [AJUDA] Novo bug no /forcartutorial - by Marco_Nutz - 13.08.2010, 16:41
Re: [AJUDA] Novo bug no /forcartutorial - by TiagoPS - 13.08.2010, 19:04
Re: [AJUDA] Novo bug no /forcartutorial - by BiieL - 13.08.2010, 19:32
Re: [AJUDA] Novo bug no /forcartutorial - by ipsBruno - 13.08.2010, 22:31
Re: [AJUDA] Novo bug no /forcartutorial - by BiieL - 13.08.2010, 22:38
Re: [AJUDA] Novo bug no /forcartutorial - by TiagoPS - 14.08.2010, 19:38

Forum Jump:


Users browsing this thread: 4 Guest(s)