[Tutorial] Specefic Cars for Gangs - 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)
+---- Forum: Tutorials (
https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] Specefic Cars for Gangs (
/showthread.php?tid=439856)
-Deleted -
mahdi499 - 27.05.2013
Please Delete
Re: Specefic Cars for Gangs -
Vince - 27.05.2013
Quote:
Originally Posted by mahdi499
an array with 19 Slots [1 is null]
|
Nope, wrong. This is only true for strings, which this array is not. All strings are arrays but not all arrays are strings.
Re: Specefic Cars for Gangs -
mahdi499 - 27.05.2013
Quote:
Originally Posted by Vince
Nope, wrong. This is only true for strings, which this array is not. All strings are arrays but not all arrays are strings.
|
Ok Thank you,i'll edit it now.
Re: Specefic Cars for Gangs -
Hernando - 27.05.2013
Nice Tutorial. Good one.
Re: Specefic Cars for Gangs -
mahdi499 - 27.05.2013
Thank you very much,I appreciate it
Re: Specefic Cars for Gangs -
Cell_ - 27.05.2013
Untested code.
RemovePlayerFromVehicle doesn't work in OnPlayerEnterVehicle, either detect the state change of the player or clear their animations under OnPlayerEnterVehicle.
Re: Specefic Cars for Gangs -
mahdi499 - 27.05.2013
Thank you,i shall test and fix everything next time,in the mean time please delete it
Re: Specefic Cars for Gangs -
Pottus - 27.05.2013
Not a really good way to do this actually, I would do it like this for best results.
This way there is no looping for checking car types since all types are predefined during vehicle creation in an array the vehicleid always references the array slot of the vehicle type.
pawn Code:
#define CAR_TYPE_COPCAR
new gCarData[MAX_VEHICLES] = { INVALID_VEHICLE_ID, ... };
public OnGameModeInit()
{
AddDynamicCar(596,1595.3313,-1709.8433,5.6725,180.4009,16,1, 3600, CAR_TYPE_COPCAR);
}
stock AddDynamicCar(model, Float:cx, Float:cy: Float:cz, Float:cfa, color1, color2, respawndelay, cartype)
{
new vindex = CreateVehicle(modelid, cx, cy, cz, cfa, color1, color2, respawndelay);
if(vindex != INVALID_VEHICLE_ID)
{
gCarData[vindex] = cartype;
return vindex;
}
return INVALID_VEHICLE_ID;
}
stock IsACopCar(carid)
{
if(gCarData[carid] == CAR_TYPE_COPCAR) return 1;
return 0;
}