need help with sscanf(params
#6

pawn Код:
CMD:aveh(playerid, params[])
{
    new Float:X, Float:Y, Float:Z, Float:Angle,veh[50],string[256],color1,color2,vehicle;
    if(pInfo[playerid][Adminlevel] < 1) return SCM(playerid, COLOR_ERROR, ""ERROR_MESSAGE"");
    if(!pInfo[playerid][LoggedInAsAdmin]) return SCM(playerid,COLOR_ERROR,""ERROR_MESSAGE"");
    if(sscanf(params,"s[50]",veh)) return SCM(playerid, COLOR_ERROR, "USAGE: /aveh (Vehicle Name) (Color) (Color)");
    if(IsPlayerInAnyVehicle(playerid)) return  SCM(playerid,COLOR_ERROR,">> You Are Already In A Vehicle.");
    GetPlayerPos(playerid, X, Y, Z);
    GetPlayerFacingAngle(playerid, Angle);
    PlayerPlaySound(playerid,1133,0.0,0.0,0.0);
    if(!sscanf(params,"s[50]dd",veh,color1,color2))
    {
        vehicle = GetVehicleModelIDFromName(veh);
        if(vehicle < 400 || vehicle > 611) return SCM(playerid, COLOR_ERROR, ">> Invalid Vehicle Name.");
        cVeh = CreateVehicle(vehicle, X+5, Y, Z, Angle, color1, color2, 1200);
    }
    if(!sscanf(params,"s[50]d",veh,color1))
    {
        color2 = color1;
        vehicle = GetVehicleModelIDFromName(veh);
        if(vehicle < 400 || vehicle > 611) return SCM(playerid, COLOR_ERROR, ">> Invalid Vehicle Name.");
        cVeh = CreateVehicle(vehicle, X+5, Y, Z, Angle, color1, color2, 1200);
    }
    if(!sscanf(params,"s",veh))
    {
        color1 = 0;
        color2 =0;
        vehicle = GetVehicleModelIDFromName(veh);
        if(vehicle < 400 || vehicle > 611) return SCM(playerid, COLOR_ERROR, ">> Invalid Vehicle Name.");
        cVeh = CreateVehicle(vehicle, X+5, Y, Z, Angle, 0, 0, 1200);
    }
    format(string, sizeof(string), ">> You have spawned a %s. ID: %i. with color %d - %d ", VehicleNames[vehicle - 400], vehicle,color1,color2);
    SCM(playerid, COLOR_SKYBLUE, string);
    PutPlayerInVehicle(playerid,cVeh,0);
    LinkVehicleToInterior(cVeh, GetPlayerInterior(playerid));
    SetVehicleVirtualWorld(cVeh, GetPlayerVirtualWorld(playerid));
    return 1;
}
vehicle is spawned but sends me this Invalid Vehicle Name.
Reply


Messages In This Thread
need help with sscanf(params - by AroseKhanNiazi - 19.07.2014, 23:33
Re: need help with sscanf(params - by sammp - 19.07.2014, 23:40
Re: need help with sscanf(params - by AroseKhanNiazi - 19.07.2014, 23:46
Re: need help with sscanf(params - by TheKillZone - 20.07.2014, 00:21
Re: need help with sscanf(params - by AroseKhanNiazi - 20.07.2014, 00:30
Re: need help with sscanf(params - by AroseKhanNiazi - 20.07.2014, 14:51
Re: need help with sscanf(params - by MehranGta - 20.07.2014, 17:10
Re: need help with sscanf(params - by AroseKhanNiazi - 20.07.2014, 17:28

Forum Jump:


Users browsing this thread: 1 Guest(s)