[HELP]Giving car with OnPlayerText...
#1

Hi, i want to give a car to players when they write its name. I mean, if a player types "Infernus", an infernus will spawn in front of him. But, for sure, we need to use GetVehicleModelIDFromName when doing it... how can i realize that?

here is GetVehicleModelIDFromName code:

pawn Код:
GetVehicleModelIDFromName(vname[])
{
        for(new i = 0; i < 211; i++)
        {
                if(strfind(VehicleNames[i], vname, true) != -1)
                return i + 400;
        }
        return -1;
}
Reply
#2

Hello

OnPlayerText
...

for(new i = 0; i < sizeof(VehicleNames); i++)
{
if(strfind(VehicleNames[i], vname, true) != -1)// if the script find our vehicle
{
new Float:PosX, Float:PosY, Float:PosZ, Float:Angle;
GetPlayerFacingAngle(playerid, Angle);
GetPlayerPos(playerid, PosX, PosY, PosZ);
CreateVehicle(i+400, PosX, PosY, PosZ, Angle, 0, 0,-1);
}
}

I think it's something like that
After, you must reflect over ^_^

Sorry for my Bad English
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)