/vehicleinfo command
#2

Your GetVehicleName function does not accept string values (you defined 'vid' as a string of 39 cells), that is why that's happening.

Код:
CMD:vinfo(playerid, params[])
{
    if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to log in first.");
	if(PlayerInfo[playerid][pAdmin] < 1) return SCM(playerid, COLOR_LIGHTGREEN3, AdminOnly);
    if(isnull(params)) return SendClientMessage(playerid, COLOR_GREY, "Syntax:{FFFFFF} /vinfo [ID/Nume]");
    new string[120], vid[39], vehicleid;
    sscanf(params, "s[39], vid);
    if(!IsNumeric(vid)
    {
        vehicleid = GetVehicleModelIDFromName(vid);
        format(string,sizeof(string),"Vehicul: %s | Model ID: %d", aVehicleNames[vehicleid - 400], vehicleid);
    }
    else
    {
        vehicleid = strval(vid);
        format(string,sizeof(string),"Vehicul: %s | Model ID: %d", GetVehicleName(vehicleid), GetVehicleModelIDFromName(GetVehicleName(vehicleid)););       
    }
	SCM(playerid, COLOR_WHITE, string);
	return 1;
}

stock IsNumeric(const string[])
{
	for (new i = 0, j = strlen(string); i < j; i++)
	{
		if (string[i] > '9' || string[i] < '0') return 0;
	}
    return 1;
}
Reply


Messages In This Thread
/vehicleinfo command - by Longover - 21.02.2019, 10:22
Re: /vehicleinfo command - by DaniceMcHarley - 21.02.2019, 12:32

Forum Jump:


Users browsing this thread: 2 Guest(s)