Base vehicles
#1

Hey,

I want to create a vehicle for my base, but when I use this code

PHP код:
//Base Vehicles
public OnGameModeInit()
{
    
// Maverick
    
CreateVehicle(487,1254.5247,224.5698,26.7311,334.7154,1,1);
    return 
1;

It shows this error:
PHP код:
C:\Users\Gebruiker\Desktop\server\gamemodes\grandlarc.pwn(410) : error 021symbol already defined"OnGameModeInit" 
And If I remove OnGameModeInit it shows even more errors.
Reply
#2

You have already defined OnGameModeInit() in your script... CNTRL+F and find the one you are not using.
Reply
#3

Quote:
Originally Posted by MrCallum
Посмотреть сообщение
You have already defined OnGameModeInit() in your script... CNTRL+F and find the one you are not using.
I need to use both though

Anyway I removed one and the following errors occure

PHP код:
C:\Users\Gebruiker\Desktop\server\gamemodes\grandlarc.pwn(409) : error 055start of function body without function header
C
:\Users\Gebruiker\Desktop\server\gamemodes\grandlarc.pwn(411) : error 021symbol already defined"CreateVehicle"
C:\Users\Gebruiker\Desktop\server\gamemodes\grandlarc.pwn(412) : error 010invalid function or declaration 
Reply
#4

Erm wat?
Why wont u place the vehicles on the other ongamemodeinit?
Show source pls.

Btw why is mark rutte your profile picture dafuq?
lold
Reply
#5

Quote:
Originally Posted by yvoms
Посмотреть сообщение
Erm wat?
Why wont u place the vehicles on the other ongamemodeinit?
Show source pls.

Btw why is mark rutte your profile picture dafuq?
lold
Mark rutte is a beast, hahaha

Anyway the full script:

PHP код:
#include <a_samp> 
public OnGameModeInit() 

    
// BaseObjects
    
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);
    
CreateObject(163751324.74841157.2710331.12687,   0.000000.000000.00000);
    return 
1

public 
OnPlayerConnect(playerid

    
//Base
    
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(playerid12941244.195384.007825.24220.25);
    
RemoveBuildingForPlayer(playerid13081248.1875109.953119.72660.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

//PlayerSpawn
public OnPlayerSpawn(playerid) { 
     
SetPlayerPos(playerid,1286.8938182.749620.2734); 
     return 
1

// Vehicles command
#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)); 
}  
//Vehicle
public OnPlayerEnterVehicle(playeridvehicleidispassenger)
{
    
// Change the primary color to black and the secondary color to white
    
ChangeVehicleColor(vehicleid11);
    return 
1;
}
//Base Vehicles
{
    
// Maverick
    
CreateVehicle(487,1254.5247,224.5698,26.7311,334.7154,1,1);
    return 
1;

Reply
#6

remove this In Last
Код:
{ 
    // Maverick 
    CreateVehicle(487,1254.5247,224.5698,26.7311,334.7154,1,1); 
    return 1; 
}
And If you want to spawn it then put
Код:
CreateVehicle(487,1254.5247,224.5698,26.7311,334.7154,1,1);
under OnGameModeInit

Also Put
Код:
// Vehicles command 
#include <a_samp>  

#define FILTERSCRIPT  
#if defined FILTERSCRIPT  

#define l_red 0xFF0000AA  
#define l_green 0x33FF33AA
At Top Of The Script (before ongamemodeinit)
Reply
#7

Quote:
Originally Posted by Devon007
Посмотреть сообщение
remove this In Last
Код:
{ 
    // Maverick 
    CreateVehicle(487,1254.5247,224.5698,26.7311,334.7154,1,1); 
    return 1; 
}
And If you want to spawn it then put
Код:
CreateVehicle(487,1254.5247,224.5698,26.7311,334.7154,1,1);
under OnGameModeInit
It shows this error now

PHP код:
C:\Users\Gebruiker\Desktop\server\gamemodes\grandlarc.pwn(409) : error 021symbol already defined"CreateVehicle" 
Reply
#8

you got 2
Код:
#include <a_samp>
remove the 2nd one
Reply
#9

Quote:
Originally Posted by Devon007
Посмотреть сообщение
you got 2
Код:
#include <a_samp>
remove the 2nd one
Still have the same error
Reply
#10

Show the full source again please
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)