SA-MP Forums Archive
Car scripting help. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Car scripting help. (/showthread.php?tid=480161)



Car scripting help. - rocker3410 - 09.12.2013

Hi I would like to create a message when someone enter the car that it says You are entering a [carname]

and Owner: [name] but how do i do that.


Re: Car scripting help. - Threshold - 09.12.2013

Can you tell us what your variable that saves the car owner's name is? Example: CarOwner[vehicleid] ?


Re: Car scripting help. - rocker3410 - 09.12.2013

That line is not inside the script. but when you do /stats it shows. your vehicle id and slot and name.

But it doesnt say you are owner or anything when you enter it.


Re: Car scripting help. - EmilLykke - 09.12.2013

This might be usefull.

pawn Код:
new VehicleNames[][] =
    {
        "Landstalker", "Bravura", "Buffalo", "Linerunner", "Perrenial", "Sentinel",
        "Dumper", "Firetruck", "Trashmaster", "Stretch", "Manana", "Infernus",
        "Voodoo", "Pony", "Mule", "Cheetah", "Ambulance", "Leviathan", "Moonbeam",
        "Esperanto", "Taxi", "Washington", "Bobcat", "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", "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", "Cropduster", "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", "Monster", "Uranus", "Jester", "Sultan", "Stratium",
        "Elegy", "Raindance", "RC Tiger", "Flash", "Tahoma", "Savanna", "Bandito",
        "Freight Flat", "Streak Carriage", "Kart", "Mower", "Dune", "Sweeper",
        "Broadway", "Tornado", "AT-400", "DFT-30", "Huntley", "Stafford", "BF-400",
        "News Van", "Tug", "Trailer", "Emperor", "Wayfarer", "Euros", "Hotdog", "Club",
        "Freight Box", "Trailer", "Andromada", "Dodo", "RC Cam", "Launch", "LSPD Cruiser",
        "SFPD Cruiser", "LVPD Cruiser", "Police Ranger", "Picador", "S.W.A.T", "Alpha",
        "Phoenix", "Glendale", "Sadler", "Luggage", "Luggage", "Stairs", "Boxville",
        "Tiller", "Utility Trailer"
    };



Re: Car scripting help. - rocker3410 - 09.12.2013

no Emil i already have that.


Re: Car scripting help. - EmilLykke - 09.12.2013

pawn Код:
format(iMsg, sizeof(iMsg), "You entered a %s.", GetVehicleName(GetPlayerVehicleID(playerid)), GetPlayerFirstName(playerid));
                    SendClientMessage(playerid, YELLOW, iMsg);
pawn Код:
stock GetVehicleName(vehicleid)
    {
        new String[28];
        format(String,sizeof(String),"%s",VehicleNames[GetVehicleModel(vehicleid) - 400]);
        return String;
    }
That should do the work for you.


Re: Car scripting help. - newbie scripter - 09.12.2013

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
        new string[200];
        format(string,sizeof(string),"You Are Driving A ~r~ %s",VehicleNames[GetVehicleModel(GetPlayerVehicleID(playerid)) - 400]);
        GameTextForPlayer(playerid,string,2000,5);
    }
    else if (newstate == PLAYER_STATE_PASSENGER)
    {
        new string[200];
        format(string,sizeof(string),"You Are Riding In A ~r~ %s",VehicleNames[GetVehicleModel(GetPlayerVehicleID(playerid)) - 400]);
        GameTextForPlayer(playerid,string,2000,5);
    }
    return 1;
}
it will work for sure, it will produce a game text showing u entered a NRG-500 etc


Re: Car scripting help. - rocker3410 - 09.12.2013

newbie scripter - F:\LARP@\gamemodes\RRP.pwn(26796) : error 017: undefined symbol "newstate"
F:\LARP@\gamemodes\RRP.pwn(2678 : error 029: invalid expression, assumed zero


Re: Car scripting help. - newbie scripter - 09.12.2013

lel what?? i don't get that error. is ur a_samp incude latest and also check if another
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
Exists