Automatic taxi sign

Scripter or interested in scripting? This place just may fancy to your likings!

Moderators: Game Admins, FM, Lead Admins

User avatar
Mmartin
Head of Development
Head of Development
Posts: 8055
Joined: Thu Mar 01, 2012 10:05 pm
Ingame name: Lucas Foreman
Location: Basement

Automatic taxi sign

Post by Mmartin » Thu Nov 01, 2012 6:43 pm

Hello, I didn't publish any of my scripts lately nor actually scripted anything for last couple of weeks. I was looking through the 0.3 objects when the taxi signs attracted my attention. This simple script allows you to turn a premier into taxi and as soon as someone enters your car, the yellow light turns off and will be plain white - signalizing that you're not available. As soon as all passengers leave your vehicle, the sign turns yellow and shiny again - showing off your availability!

It would not be me if I'd not include a secret (well not really secret) bug into the script to avoid a plain copy paste. Once you despawn the permier (despawn, not destroy), the attached object will stay and will stick to a next spawned vehicle.

Thankies goes to Ferdinand and SirEric for help with testing.

Commands:
/maketaxi - turns a premier into taxi.
Video:
[video]http://www.youtube.com/watch?v=jRQEUl0s11U&feature=youtu.be[/video]
Codes:

Code: Select all

new lastcar[MAX_PLAYERS];
new objTaxi[MAX_VEHICLES];
new isTaxi[MAX_VEHICLES];

Code: Select all

public OnPlayerStateChange(playerid, newstate, oldstate)
{
   if(newstate == PLAYER_STATE_PASSENGER || newstate == PLAYER_STATE_DRIVER) lastcar[playerid]=GetPlayerVehicleID(playerid);
   new vehicleid=GetPlayerVehicleID(playerid);
   if(isTaxi[vehicleid] && ((newstate == PLAYER_STATE_PASSENGER && IsSeatTaken(vehicleid,0)) || (newstate == PLAYER_STATE_DRIVER &&IsSeatTaken(vehicleid,1) || IsSeatTaken(vehicleid,2) || IsSeatTaken(vehicleid,3) || IsSeatTaken(vehicleid,4))))
   {
       DestroyObject(objTaxi[vehicleid]);
       objTaxi[vehicleid] = CreateObject(19310,0,0,0,0,0,0);
      AttachObjectToVehicle(objTaxi[vehicleid], vehicleid, 0, -0.5, 0.94, 0, 0, 90);
   }
   if(isTaxi[lastcar[playerid]] && oldstate == PLAYER_STATE_PASSENGER && (!IsSeatTaken(lastcar[playerid],1) && !IsSeatTaken(lastcar[playerid],2) && !IsSeatTaken(lastcar[playerid],3)))
   {
       DestroyObject(objTaxi[lastcar[playerid]]);
      objTaxi[lastcar[playerid]] = CreateObject(19308,0,0,0,0,0,0);
      AttachObjectToVehicle(objTaxi[lastcar[playerid]], lastcar[playerid], 0, -0.5, 0.94, 0, 0, 90);
   }
   return 1;
}

Code: Select all

if (strcmp("/maketaxi", cmdtext, true, 20) == 0)
   {
       if(!IsPlayerInAnyVehicle(playerid)) return SCM(playerid,zlta,"Error: You aren't in a premier.");
       if(GetVehicleModel(GetPlayerVehicleID(playerid)) != 426) return SCM(playerid,zlta,"Error: You aren't in a premier.");
       if(isTaxi[GetPlayerVehicleID(playerid)])
       {
         DestroyObject(objTaxi[GetPlayerVehicleID(playerid)]);
         isTaxi[GetPlayerVehicleID(playerid)]=false;
       }else{
           objTaxi[GetPlayerVehicleID(playerid)] = CreateObject(19308,0,0,0,0,0,0);
         AttachObjectToVehicle(objTaxi[GetPlayerVehicleID(playerid)], GetPlayerVehicleID(playerid), 0, -0.5, 0.94, 0, 0, 90);
         isTaxi[GetPlayerVehicleID(playerid)]=true;
       }
      return 1;
   }
Image Mmartin
Development Team SA-MP Tester Team
Image

Will be on absence 20-23 October

User avatar
Gooday
Wannabe Don
Wannabe Don
Posts: 1905
Joined: Mon Apr 16, 2012 4:27 pm
Ingame name: Bryan_Hartley
Location: #TeamGrande
Contact:

Re: Automatic taxi sign

Post by Gooday » Sun Nov 04, 2012 12:11 pm

Really nice script!
I can show of too!: show
ImageImage
Image
Image
Retired Mapper - 2012/2014

User avatar
Money Train
Mafia
Mafia
Posts: 549
Joined: Mon Oct 29, 2012 1:45 pm
Ingame name: Barney

Re: Automatic taxi sign

Post by Money Train » Sun Nov 11, 2012 4:41 am

Oh yes! Going to use this.
Image

Famous Star.
Gangster
Gangster
Posts: 122
Joined: Sun Oct 28, 2012 11:38 pm

Re: Automatic taxi sign

Post by Famous Star. » Sun Nov 11, 2012 11:39 pm

Would be great if you could use your own vehicle, get private taxi license, you know?

User avatar
Bora!
Wannabe Don
Wannabe Don
Posts: 1047
Joined: Sat Jul 09, 2011 4:35 pm
Ingame name: Jeffrey Walters

Re: Automatic taxi sign

Post by Bora! » Sat Nov 17, 2012 1:23 pm

Premier, being the Ford Crown Vics. - is a common type of vehicle for Taxi Services, as well as LEOs. However, there are many other vehicles, that are painted yellow and added decays, which you can use it as a taxi, legally. Maybe, having this command for every single vehicle could do a great good.
Absent.

User avatar
pablo.
Forum Moderator
Posts: 2614
Joined: Sun Jun 24, 2012 9:16 pm
Ingame name: Jiao Lei

Re: Automatic taxi sign

Post by pablo. » Tue Nov 20, 2012 8:01 pm

Wow! This is really quite amazing actually! Good job!

Dat sausage
Mafia
Mafia
Posts: 593
Joined: Fri Mar 16, 2012 5:42 am
Ingame name: Antonella Pugliese
Location: South America.

Re: Automatic taxi sign

Post by Dat sausage » Fri Dec 28, 2012 3:34 am

Premier is based of a 92' Caprice and not a Crown Vic.

OT: Dope, hope they use this it realy usefull for the taxi job. Tho, it should be allowed on certain car only, like 4 door sedans (no sultan), else fools will taxi drive with their cheetahs.

User avatar
RazorfaG
Wannabe Don
Wannabe Don
Posts: 4095
Joined: Wed May 30, 2012 1:23 am

Re: Automatic taxi sign

Post by RazorfaG » Sat Dec 29, 2012 7:13 pm

Make the same for PD/SD cars :P, would be cool.

a$ap nitti
Wannabe Don
Wannabe Don
Posts: 1048
Joined: Mon Sep 26, 2011 2:25 pm
Location: unknown
Contact:

Re: Automatic taxi sign

Post by a$ap nitti » Tue Jul 16, 2013 10:42 pm

This is amazing Mmartin damn!

User avatar
Kentzy
Mafia
Mafia
Posts: 513
Joined: Thu Jan 03, 2013 1:29 am
Ingame name: A. DeLuca
Location: Romania, Giurgiu

Re: Automatic taxi sign

Post by Kentzy » Wed Jul 17, 2013 4:03 pm

Oah , this is so damn cool , to have any car as taxi just paint the car yellow and tadaaa a cool taxi.
How would be to drive a Sultan Taxi :D

User avatar
Nogga
Wannabe Don
Wannabe Don
Posts: 1944
Joined: Sun Mar 30, 2008 10:02 am
Ingame name: Tavon Wilson
Location: Leeds, West Yorkshire

Re: Automatic taxi sign

Post by Nogga » Thu Aug 01, 2013 12:26 pm

Yeah, four door taxis like Washingtons would be cool, just attach the taxi object to any vehicle and you're free to go!
"It takes time for people to fall in love with you... but it's inevitable."

User avatar
Moss
Mafia
Mafia
Posts: 499
Joined: Tue Oct 02, 2012 5:26 am
Ingame name: -.-.-.-.-.

Re: Automatic taxi sign

Post by Moss » Thu Sep 19, 2013 10:48 pm

This is amazing!
One Day I will back :)
YouTube Channel:
https://www.youtube.com/user/DeFFeCTivECAEU

Slymind
Impact
Impact
Posts: 268
Joined: Sun Aug 18, 2013 6:35 pm

Re: Automatic taxi sign

Post by Slymind » Fri Sep 20, 2013 6:47 pm

"Step out bitch"

:) nice script.

User avatar
Hardrperxd
Civilian
Civilian
Posts: 11
Joined: Fri Sep 20, 2013 4:36 pm
Ingame name: Michael Devontre
Location: Bosnia

Re: Automatic taxi sign

Post by Hardrperxd » Sat Sep 21, 2013 8:25 am

I like the step out part haha

User avatar
Aquilus
- Bronze Member -
- Bronze Member -
Posts: 72
Joined: Tue Oct 01, 2013 7:00 pm

Re: Automatic taxi sign

Post by Aquilus » Tue Oct 01, 2013 7:18 pm

Well done, mate.

Post Reply

Return to “Scripting Section”

Who is online

Users browsing this forum: No registered users and 2 guests