/veh command
#1

Hey,

I searched for a /veh spawning command and I found one, but when I compile it it gives the following errors
PHP код:
C:\Users\Gebruiker\Desktop\server\gamemodes\grandlarc.pwn(316) : error 003declaration of a local variable must appear in a compound block
C
:\Users\Gebruiker\Desktop\server\gamemodes\grandlarc.pwn(316) : warning 217loose indentation
C
:\Users\Gebruiker\Desktop\server\gamemodes\grandlarc.pwn(316) : error 017undefined symbol "String"
C:\Users\Gebruiker\Desktop\server\gamemodes\grandlarc.pwn(316) : warning 215expression has no effect
C
:\Users\Gebruiker\Desktop\server\gamemodes\grandlarc.pwn(316) : error 001expected token";"but found "]"
C:\Users\Gebruiker\Desktop\server\gamemodes\grandlarc.pwn(316) : fatal error 107too many error messages on one line 
This is my entire script:
PHP код:
#include <a_samp>
public OnGameModeInit()
{
    
// some code
    
CreateObject(36071300.45557169.5523225.58073,   0.000000.0000067.82463);
    
CreateObject(161511310.16003134.0597719.82454,   0.000000.00000333.26828);
    
CreateObject(14321304.92847132.4687819.59503,   0.000000.000000.00000);
    
CreateObject(14321306.75659137.7992719.49764,   0.000000.000000.00000);
    
CreateObject(14321303.53137137.6843619.49949,   0.000000.000000.00000);
    
CreateObject(14321305.59802135.1932519.58012,   0.000000.000000.00000);
    
CreateObject(14321302.52734134.5157919.54607,   0.000000.000000.00000);
    
CreateObject(17751314.34595140.6454820.30334,   0.000000.00000245.46411);
    
CreateObject(98331282.91980174.5224521.36313,   0.000000.00000356.52475);
    
CreateObject(6521292.24011152.5718819.41948,   0.000000.000000.00000);
    
CreateObject(6521305.55396184.8426119.43826,   0.000000.000000.00000);
    
CreateObject(98331296.68933144.3561921.36313,   0.000000.00000356.52475);
    
CreateObject(98331282.91980174.5224521.36313,   0.000000.00000356.52475);
    
CreateObject(98331314.00745190.9466721.36313,   0.000000.00000356.52475);
    
CreateObject(14321304.87524139.7491019.49949,   0.000000.000000.00000);
    
CreateObject(14321301.96289131.8535219.54607,   0.000000.000000.00000);
    
CreateObject(14321302.20081139.7808419.54607,   0.000000.000000.00000);
    
CreateObject(14321301.09131136.7968019.54607,   0.000000.000000.00000);
    
CreateObject(14321299.97571133.7131519.54607,   0.000000.000000.00000);
    return 
1;
}
public 
OnPlayerConnect(playerid)
{
    
// some code
    
RemoveBuildingForPlayer(playerid33391297.2813173.578119.46090.25);
    
RemoveBuildingForPlayer(playerid33401308.3984168.140619.40630.25);
    
RemoveBuildingForPlayer(playerid33411281.2266158.093819.34380.25);
    
RemoveBuildingForPlayer(playerid33431295.9844158.742219.38280.25);
    
RemoveBuildingForPlayer(playerid33431305.0391184.914119.34380.25);
    
RemoveBuildingForPlayer(playerid33451298.6094194.265619.32810.25);
    
RemoveBuildingForPlayer(playerid33451305.2656152.773419.29690.25);
    
RemoveBuildingForPlayer(playerid33441299.7109138.734419.34380.25);
    
RemoveBuildingForPlayer(playerid33441313.9688179.843819.35940.25);
    
RemoveBuildingForPlayer(playerid35941265.5703153.382819.46090.25);
    
RemoveBuildingForPlayer(playerid7691267.9141146.820319.19530.25);
    
RemoveBuildingForPlayer(playerid31701281.2266158.093819.34380.25);
    
RemoveBuildingForPlayer(playerid35941280.9297147.312520.00780.25);
    
RemoveBuildingForPlayer(playerid31681295.9844158.742219.38280.25);
    
RemoveBuildingForPlayer(playerid31711299.7109138.734419.34380.25);
    
RemoveBuildingForPlayer(playerid31721305.2656152.773419.29690.25);
    
RemoveBuildingForPlayer(playerid13081301.2578147.382818.82030.25);
    
RemoveBuildingForPlayer(playerid7801301.5938154.507819.32810.25);
    
RemoveBuildingForPlayer(playerid35941271.3125163.390619.43750.25);
    
RemoveBuildingForPlayer(playerid12941264.5469172.218823.00780.25);
    
RemoveBuildingForPlayer(playerid13081281.5156165.531318.82030.25);
    
RemoveBuildingForPlayer(playerid14401297.0703179.226619.94530.25);
    
RemoveBuildingForPlayer(playerid14401293.5547163.882819.94530.25);
    
RemoveBuildingForPlayer(playerid31681305.0391184.914119.34380.25);
    
RemoveBuildingForPlayer(playerid31691297.2813173.578119.46090.25);
    
RemoveBuildingForPlayer(playerid7751301.2734164.265619.35160.25);
    
RemoveBuildingForPlayer(playerid7641303.6328173.398418.93750.25);
    
RemoveBuildingForPlayer(playerid31711313.9688179.843819.35940.25);
    
RemoveBuildingForPlayer(playerid31671308.3984168.140619.40630.25);
    
RemoveBuildingForPlayer(playerid13081308.2656174.289118.82030.25);
    
RemoveBuildingForPlayer(playerid14401313.3203167.031319.94530.25);
    
RemoveBuildingForPlayer(playerid7091358.1484166.523419.46090.25);
    
RemoveBuildingForPlayer(playerid31721298.6094194.265619.32810.25);
    
RemoveBuildingForPlayer(playerid13081274.1875191.460918.82030.25);
    
RemoveBuildingForPlayer(playerid14381276.1172190.226618.60940.25);
    
RemoveBuildingForPlayer(playerid6171324.7266187.351617.78130.25);
    
RemoveBuildingForPlayer(playerid14401318.3828196.054719.60940.25);
    
RemoveBuildingForPlayer(playerid7051290.4766198.679718.76560.25);
    
RemoveBuildingForPlayer(playerid134411338.0625198.734430.02340.25);
    return 
1;
}
public 
OnPlayerSpawn(playerid) {
     
SetPlayerPos(playerid,1286.8938182.749620.2734);
     return 
1;
}
#include <a_samp>
#define FILTERSCRIPT
#if defined FILTERSCRIPT
#define l_red 0xFF0000AA
#define l_green 0x33FF33AA
new aVehicleNames[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"}
};
#endif
public OnPlayerCommandText(playeridcmdtext[])
{
    new 
cmd[200], idx;
    
cmd strtok(cmdtextidx);
    if(
strcmp(cmd"/veh"true10) == 0)
        
LINE 116 new String[200];
        new 
tmp[256];
        new 
Float:xFloat:yFloat:z;
        
tmp strtok(cmdtextidx);
        if(!
strlen(tmp)) return SendClientMessage(playeridl_red"You didn't give a vehicle name");
        new 
vehicle GetVehicleModelIDFromName(tmp);
        if(
vehicle 400 || vehicle 611) return SendClientMessage(playeridl_red"That vehicle name was not found");
        new 
Float:a;
        
GetPlayerFacingAngle(playerida);
        
GetPlayerPos(playeridxyz);
        if(
IsPlayerInAnyVehicle(playerid) == 1)
        {
            
GetXYInFrontOfPlayer(playeridxy8);
        }
        else
        {
            
GetXYInFrontOfPlayer(playeridxy5);
        }
        new 
PlayersVehicle CreateVehicle(vehiclexyza+90, -1, -1, -1);
        
LinkVehicleToInterior(PlayersVehicleGetPlayerInterior(playerid));
        
format(Stringsizeof(String), "You have spawned a %s"aVehicleNames[vehicle 400]);
        
SendClientMessage(playeridl_greenString);
        return 
1;
    }
    return 
0;
}
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;
}
GetVehicleModelIDFromName(vname[])
{
    for(new 
0211i++)
    {
        if(
strfind(aVehicleNames[i], vnametrue) != -1)
        return 
400;
    }
    return -
1;
}
stock GetXYInFrontOfPlayer(playerid, &Float:x2, &Float:y2Float:distance)
{
    new 
Float:a;
    
GetPlayerPos(playeridx2y2a);
    
GetPlayerFacingAngle(playerida);
    if(
GetPlayerVehicleID(playerid))
    {
        
GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
    }
    
x2 += (distance floatsin(-adegrees));
    
y2 += (distance floatcos(-adegrees));

I hope someone can help me!
Reply
#2

pawn Код:
#include <a_samp>


public OnGameModeInit()
{
    // some code

    CreateObject(3607, 1300.45557, 169.55232, 25.58073,   0.00000, 0.00000, 67.82463);
    CreateObject(16151, 1310.16003, 134.05977, 19.82454,   0.00000, 0.00000, 333.26828);
    CreateObject(1432, 1304.92847, 132.46878, 19.59503,   0.00000, 0.00000, 0.00000);
    CreateObject(1432, 1306.75659, 137.79927, 19.49764,   0.00000, 0.00000, 0.00000);
    CreateObject(1432, 1303.53137, 137.68436, 19.49949,   0.00000, 0.00000, 0.00000);
    CreateObject(1432, 1305.59802, 135.19325, 19.58012,   0.00000, 0.00000, 0.00000);
    CreateObject(1432, 1302.52734, 134.51579, 19.54607,   0.00000, 0.00000, 0.00000);
    CreateObject(1775, 1314.34595, 140.64548, 20.30334,   0.00000, 0.00000, 245.46411);
    CreateObject(9833, 1282.91980, 174.52245, 21.36313,   0.00000, 0.00000, 356.52475);
    CreateObject(652, 1292.24011, 152.57188, 19.41948,   0.00000, 0.00000, 0.00000);
    CreateObject(652, 1305.55396, 184.84261, 19.43826,   0.00000, 0.00000, 0.00000);
    CreateObject(9833, 1296.68933, 144.35619, 21.36313,   0.00000, 0.00000, 356.52475);
    CreateObject(9833, 1282.91980, 174.52245, 21.36313,   0.00000, 0.00000, 356.52475);
    CreateObject(9833, 1314.00745, 190.94667, 21.36313,   0.00000, 0.00000, 356.52475);
    CreateObject(1432, 1304.87524, 139.74910, 19.49949,   0.00000, 0.00000, 0.00000);
    CreateObject(1432, 1301.96289, 131.85352, 19.54607,   0.00000, 0.00000, 0.00000);
    CreateObject(1432, 1302.20081, 139.78084, 19.54607,   0.00000, 0.00000, 0.00000);
    CreateObject(1432, 1301.09131, 136.79680, 19.54607,   0.00000, 0.00000, 0.00000);
    CreateObject(1432, 1299.97571, 133.71315, 19.54607,   0.00000, 0.00000, 0.00000);

    return 1;
}

public OnPlayerConnect(playerid)
{
    // some code

    RemoveBuildingForPlayer(playerid, 3339, 1297.2813, 173.5781, 19.4609, 0.25);
    RemoveBuildingForPlayer(playerid, 3340, 1308.3984, 168.1406, 19.4063, 0.25);
    RemoveBuildingForPlayer(playerid, 3341, 1281.2266, 158.0938, 19.3438, 0.25);
    RemoveBuildingForPlayer(playerid, 3343, 1295.9844, 158.7422, 19.3828, 0.25);
    RemoveBuildingForPlayer(playerid, 3343, 1305.0391, 184.9141, 19.3438, 0.25);
    RemoveBuildingForPlayer(playerid, 3345, 1298.6094, 194.2656, 19.3281, 0.25);
    RemoveBuildingForPlayer(playerid, 3345, 1305.2656, 152.7734, 19.2969, 0.25);
    RemoveBuildingForPlayer(playerid, 3344, 1299.7109, 138.7344, 19.3438, 0.25);
    RemoveBuildingForPlayer(playerid, 3344, 1313.9688, 179.8438, 19.3594, 0.25);
    RemoveBuildingForPlayer(playerid, 3594, 1265.5703, 153.3828, 19.4609, 0.25);
    RemoveBuildingForPlayer(playerid, 769, 1267.9141, 146.8203, 19.1953, 0.25);
    RemoveBuildingForPlayer(playerid, 3170, 1281.2266, 158.0938, 19.3438, 0.25);
    RemoveBuildingForPlayer(playerid, 3594, 1280.9297, 147.3125, 20.0078, 0.25);
    RemoveBuildingForPlayer(playerid, 3168, 1295.9844, 158.7422, 19.3828, 0.25);
    RemoveBuildingForPlayer(playerid, 3171, 1299.7109, 138.7344, 19.3438, 0.25);
    RemoveBuildingForPlayer(playerid, 3172, 1305.2656, 152.7734, 19.2969, 0.25);
    RemoveBuildingForPlayer(playerid, 1308, 1301.2578, 147.3828, 18.8203, 0.25);
    RemoveBuildingForPlayer(playerid, 780, 1301.5938, 154.5078, 19.3281, 0.25);
    RemoveBuildingForPlayer(playerid, 3594, 1271.3125, 163.3906, 19.4375, 0.25);
    RemoveBuildingForPlayer(playerid, 1294, 1264.5469, 172.2188, 23.0078, 0.25);
    RemoveBuildingForPlayer(playerid, 1308, 1281.5156, 165.5313, 18.8203, 0.25);
    RemoveBuildingForPlayer(playerid, 1440, 1297.0703, 179.2266, 19.9453, 0.25);
    RemoveBuildingForPlayer(playerid, 1440, 1293.5547, 163.8828, 19.9453, 0.25);
    RemoveBuildingForPlayer(playerid, 3168, 1305.0391, 184.9141, 19.3438, 0.25);
    RemoveBuildingForPlayer(playerid, 3169, 1297.2813, 173.5781, 19.4609, 0.25);
    RemoveBuildingForPlayer(playerid, 775, 1301.2734, 164.2656, 19.3516, 0.25);
    RemoveBuildingForPlayer(playerid, 764, 1303.6328, 173.3984, 18.9375, 0.25);
    RemoveBuildingForPlayer(playerid, 3171, 1313.9688, 179.8438, 19.3594, 0.25);
    RemoveBuildingForPlayer(playerid, 3167, 1308.3984, 168.1406, 19.4063, 0.25);
    RemoveBuildingForPlayer(playerid, 1308, 1308.2656, 174.2891, 18.8203, 0.25);
    RemoveBuildingForPlayer(playerid, 1440, 1313.3203, 167.0313, 19.9453, 0.25);
    RemoveBuildingForPlayer(playerid, 709, 1358.1484, 166.5234, 19.4609, 0.25);
    RemoveBuildingForPlayer(playerid, 3172, 1298.6094, 194.2656, 19.3281, 0.25);
    RemoveBuildingForPlayer(playerid, 1308, 1274.1875, 191.4609, 18.8203, 0.25);
    RemoveBuildingForPlayer(playerid, 1438, 1276.1172, 190.2266, 18.6094, 0.25);
    RemoveBuildingForPlayer(playerid, 617, 1324.7266, 187.3516, 17.7813, 0.25);
    RemoveBuildingForPlayer(playerid, 1440, 1318.3828, 196.0547, 19.6094, 0.25);
    RemoveBuildingForPlayer(playerid, 705, 1290.4766, 198.6797, 18.7656, 0.25);
    RemoveBuildingForPlayer(playerid, 13441, 1338.0625, 198.7344, 30.0234, 0.25);
    return 1;
}

public OnPlayerSpawn(playerid) {
     SetPlayerPos(playerid,1286.8938, 182.7496, 20.2734);
     return 1;
}

#define l_red 0xFF0000AA
#define l_green 0x33FF33AA

new aVehicleNames[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 OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[200], idx;
    cmd = strtok(cmdtext, idx);

    if(strcmp(cmd, "/veh", true, 10) == 0) {

        new String[200];
        new tmp[256];
        new Float:x, Float:y, Float:z;

        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) return SendClientMessage(playerid, l_red, "You didn't give a vehicle name");

        new vehicle = GetVehicleModelIDFromName(tmp);

        if(vehicle < 400 || vehicle > 611) return SendClientMessage(playerid, l_red, "That vehicle name was not found");

        new Float:a;
        GetPlayerFacingAngle(playerid, a);
        GetPlayerPos(playerid, x, y, z);

        if(IsPlayerInAnyVehicle(playerid) == 1)
        {
            GetXYInFrontOfPlayer(playerid, x, y, 8);
        }
        else
        {
            GetXYInFrontOfPlayer(playerid, x, y, 5);
        }

        new PlayersVehicle = CreateVehicle(vehicle, x, y, z, a+90, -1, -1, -1);
        LinkVehicleToInterior(PlayersVehicle, GetPlayerInterior(playerid));

        format(String, sizeof(String), "You have spawned a %s", aVehicleNames[vehicle - 400]);
        SendClientMessage(playerid, l_green, String);
        return 1;
    }
    return 0;
}

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;
}

GetVehicleModelIDFromName(vname[])
{
    for(new i = 0; i < 211; i++)
    {
        if(strfind(aVehicleNames[i], vname, true) != -1)
        return i + 400;
    }
    return -1;
}

stock GetXYInFrontOfPlayer(playerid, &Float:x2, &Float:y2, Float:distance)
{
    new Float:a;

    GetPlayerPos(playerid, x2, y2, a);
    GetPlayerFacingAngle(playerid, a);

    if(GetPlayerVehicleID(playerid))
    {
        GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
    }

    x2 += (distance * floatsin(-a, degrees));
    y2 += (distance * floatcos(-a, degrees));
}
Reply
#3

PHP код:
if(strcmp(cmd"/veh"true10) == 0
you just missed { after it it should be:
Код:
if(strcmp(cmd, "/veh", true, 10) == 0) {
full code:
PHP код:
#include <a_samp>
public OnGameModeInit()
{
    
// some code
    
CreateObject(36071300.45557169.5523225.58073,   0.000000.0000067.82463);
    
CreateObject(161511310.16003134.0597719.82454,   0.000000.00000333.26828);
    
CreateObject(14321304.92847132.4687819.59503,   0.000000.000000.00000);
    
CreateObject(14321306.75659137.7992719.49764,   0.000000.000000.00000);
    
CreateObject(14321303.53137137.6843619.49949,   0.000000.000000.00000);
    
CreateObject(14321305.59802135.1932519.58012,   0.000000.000000.00000);
    
CreateObject(14321302.52734134.5157919.54607,   0.000000.000000.00000);
    
CreateObject(17751314.34595140.6454820.30334,   0.000000.00000245.46411);
    
CreateObject(98331282.91980174.5224521.36313,   0.000000.00000356.52475);
    
CreateObject(6521292.24011152.5718819.41948,   0.000000.000000.00000);
    
CreateObject(6521305.55396184.8426119.43826,   0.000000.000000.00000);
    
CreateObject(98331296.68933144.3561921.36313,   0.000000.00000356.52475);
    
CreateObject(98331282.91980174.5224521.36313,   0.000000.00000356.52475);
    
CreateObject(98331314.00745190.9466721.36313,   0.000000.00000356.52475);
    
CreateObject(14321304.87524139.7491019.49949,   0.000000.000000.00000);
    
CreateObject(14321301.96289131.8535219.54607,   0.000000.000000.00000);
    
CreateObject(14321302.20081139.7808419.54607,   0.000000.000000.00000);
    
CreateObject(14321301.09131136.7968019.54607,   0.000000.000000.00000);
    
CreateObject(14321299.97571133.7131519.54607,   0.000000.000000.00000);
    return 
1;
}
public 
OnPlayerConnect(playerid)
{
    
// some code
    
RemoveBuildingForPlayer(playerid33391297.2813173.578119.46090.25);
    
RemoveBuildingForPlayer(playerid33401308.3984168.140619.40630.25);
    
RemoveBuildingForPlayer(playerid33411281.2266158.093819.34380.25);
    
RemoveBuildingForPlayer(playerid33431295.9844158.742219.38280.25);
    
RemoveBuildingForPlayer(playerid33431305.0391184.914119.34380.25);
    
RemoveBuildingForPlayer(playerid33451298.6094194.265619.32810.25);
    
RemoveBuildingForPlayer(playerid33451305.2656152.773419.29690.25);
    
RemoveBuildingForPlayer(playerid33441299.7109138.734419.34380.25);
    
RemoveBuildingForPlayer(playerid33441313.9688179.843819.35940.25);
    
RemoveBuildingForPlayer(playerid35941265.5703153.382819.46090.25);
    
RemoveBuildingForPlayer(playerid7691267.9141146.820319.19530.25);
    
RemoveBuildingForPlayer(playerid31701281.2266158.093819.34380.25);
    
RemoveBuildingForPlayer(playerid35941280.9297147.312520.00780.25);
    
RemoveBuildingForPlayer(playerid31681295.9844158.742219.38280.25);
    
RemoveBuildingForPlayer(playerid31711299.7109138.734419.34380.25);
    
RemoveBuildingForPlayer(playerid31721305.2656152.773419.29690.25);
    
RemoveBuildingForPlayer(playerid13081301.2578147.382818.82030.25);
    
RemoveBuildingForPlayer(playerid7801301.5938154.507819.32810.25);
    
RemoveBuildingForPlayer(playerid35941271.3125163.390619.43750.25);
    
RemoveBuildingForPlayer(playerid12941264.5469172.218823.00780.25);
    
RemoveBuildingForPlayer(playerid13081281.5156165.531318.82030.25);
    
RemoveBuildingForPlayer(playerid14401297.0703179.226619.94530.25);
    
RemoveBuildingForPlayer(playerid14401293.5547163.882819.94530.25);
    
RemoveBuildingForPlayer(playerid31681305.0391184.914119.34380.25);
    
RemoveBuildingForPlayer(playerid31691297.2813173.578119.46090.25);
    
RemoveBuildingForPlayer(playerid7751301.2734164.265619.35160.25);
    
RemoveBuildingForPlayer(playerid7641303.6328173.398418.93750.25);
    
RemoveBuildingForPlayer(playerid31711313.9688179.843819.35940.25);
    
RemoveBuildingForPlayer(playerid31671308.3984168.140619.40630.25);
    
RemoveBuildingForPlayer(playerid13081308.2656174.289118.82030.25);
    
RemoveBuildingForPlayer(playerid14401313.3203167.031319.94530.25);
    
RemoveBuildingForPlayer(playerid7091358.1484166.523419.46090.25);
    
RemoveBuildingForPlayer(playerid31721298.6094194.265619.32810.25);
    
RemoveBuildingForPlayer(playerid13081274.1875191.460918.82030.25);
    
RemoveBuildingForPlayer(playerid14381276.1172190.226618.60940.25);
    
RemoveBuildingForPlayer(playerid6171324.7266187.351617.78130.25);
    
RemoveBuildingForPlayer(playerid14401318.3828196.054719.60940.25);
    
RemoveBuildingForPlayer(playerid7051290.4766198.679718.76560.25);
    
RemoveBuildingForPlayer(playerid134411338.0625198.734430.02340.25);
    return 
1;
}
public 
OnPlayerSpawn(playerid) {
     
SetPlayerPos(playerid,1286.8938182.749620.2734);
     return 
1;
}
#include <a_samp>
#define FILTERSCRIPT
#if defined FILTERSCRIPT
#define l_red 0xFF0000AA
#define l_green 0x33FF33AA
new aVehicleNames[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"}
};
#endif
public OnPlayerCommandText(playeridcmdtext[])
{
    new 
cmd[200], idx;
    
cmd strtok(cmdtextidx);
    if(
strcmp(cmd"/veh"true10) == 0) {
        new 
String[200];
        new 
tmp[256];
        new 
Float:xFloat:yFloat:z;
        
tmp strtok(cmdtextidx);
        if(!
strlen(tmp)) return SendClientMessage(playeridl_red"You didn't give a vehicle name");
        new 
vehicle GetVehicleModelIDFromName(tmp);
        if(
vehicle 400 || vehicle 611) return SendClientMessage(playeridl_red"That vehicle name was not found");
        new 
Float:a;
        
GetPlayerFacingAngle(playerida);
        
GetPlayerPos(playeridxyz);
        if(
IsPlayerInAnyVehicle(playerid) == 1)
        {
            
GetXYInFrontOfPlayer(playeridxy8);
        }
        else
        {
            
GetXYInFrontOfPlayer(playeridxy5);
        }
        new 
PlayersVehicle CreateVehicle(vehiclexyza+90, -1, -1, -1);
        
LinkVehicleToInterior(PlayersVehicleGetPlayerInterior(playerid));
        
format(Stringsizeof(String), "You have spawned a %s"aVehicleNames[vehicle 400]);
        
SendClientMessage(playeridl_greenString);
        return 
1;
    }
    return 
0;
}
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;
}
GetVehicleModelIDFromName(vname[])
{
    for(new 
0211i++)
    {
        if(
strfind(aVehicleNames[i], vnametrue) != -1)
        return 
400;
    }
    return -
1;
}
stock GetXYInFrontOfPlayer(playerid, &Float:x2, &Float:y2Float:distance)
{
    new 
Float:a;
    
GetPlayerPos(playeridx2y2a);
    
GetPlayerFacingAngle(playerida);
    if(
GetPlayerVehicleID(playerid))
    {
        
GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
    }
    
x2 += (distance floatsin(-adegrees));
    
y2 += (distance floatcos(-adegrees));

@ if(ATGOggy) {



}
Reply
#4

thanks, the script works. But now I have the problem. I don't know how to set a vehicle spawn at a certain place.
Can anyone help me with that?
Reply
#5

How do you exactly mean? Do you mean like, when re-starting the server the vehicle should be parked at the certain place again?
Reply
#6

Quote:
Originally Posted by saffierr
Посмотреть сообщение
How do you exactly mean? Do you mean like, when re-starting the server the vehicle should be parked at the certain place again?
I mean it should be in a certain place when the vehicle explodes or the server re-starts.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)