Vcreate
#2

PHP код:
stock GetModelVehicle(vname[]) 
{
    for(new 
0211i++)
    {
        if(
strfind(VehicleNames[i], vnametrue) != -1)
        return 
400;
    }
    return 
false;
}
CMD:vcreate(playeridparams[])
{
    new 
vname[30];
    if(
sscanf(params"s[30]"vname))
        return 
SendClientMessage(playeridCOLOR_WHITE"{ff0000}[Error]:{ffffff} /vcreate [vehicle name]");
    else if(
IsPlayerInAnyVehicle(playerid))
        return 
SendClientMessage(playerid0xFF0000FF"{ff0000}[Error]:{ffffff} You are already in a vehicle.");
    new 
model GetModelVehicle(vname);
    if(
model 400 || model 611) return SendClientMessage(playerid, -1"{ff0000}[Error]:{ffffff} /vcreate [vehicle name]");
                
    new 
Float:x,Float:y,Float:z,Float:r,Float:nX,Float:nY,Float:nZ;
    
    
GetPlayerPos(playeridxyz);
    
GetPlayerFacingAngle(playerid,r);
    
+= (3.0 floatsin(-rdegrees));
    
+= (3.0 floatcos(-rdegrees));
    new 
vehicleid CreateVehicle(modelxyz+1.0r+90, -1, -15000);
    
    
SetVehicleVirtualWorld(vehicleidGetPlayerVirtualWorld(playerid));
    
LinkVehicleToInterior(vehicleidGetPlayerInterior(playerid));
    
    new 
tmpstr[100];
    
format(tmpstrsizeof(tmpstr), "You have spawned a %s."GetVehicleName(vehicleid));
    return 
SendClientMessage(playeridCOLOR_WHITEtmpstr);

EDIT: Updated code. Try again.
Reply


Messages In This Thread
Vcreate - by yvoms - 25.07.2016, 17:17
Re: Vcreate - by DarkSkull - 25.07.2016, 17:47
Re: Vcreate - by Konstantinos - 25.07.2016, 17:50
Re: Vcreate - by yvoms - 25.07.2016, 20:49
Re: Vcreate - by Konstantinos - 25.07.2016, 21:11

Forum Jump:


Users browsing this thread: 1 Guest(s)