ZCMD: Unknown command
#1

/test is meant to tell me whether or not the vehicle I am sat in is a cop car or not. When performed inside of an FBI Rancher it returns "SERVER: Unknown Command
pawn Код:
CMD:test(playerid, params[])
{
    new veh = GetPlayerVehicleID(playerid);
    if(IsACopCar(veh))
    {
        SendClientMessage(playerid, -1, "Car is a cop car.");
        return true;
    }
    return false;
}
pawn Код:
public IsACopCar(vehicleid)
{
    new vm = GetVehicleModel(vehicleid);
    {
        if(VehicleList[vm - 400][VehType] == VEHICLE_TYPE_GOV) return true;
    }
    return false;
}
pawn Код:
enum VehicleListEnum {
    VehModel,
    VehName[50],
    VehType,
    VehWindows,
    VehTrunk,
    VehDoors,
    VehPrice
};

new VehicleList[][VehicleListEnum] = {
{490, "FBI Rancher", VEHICLE_TYPE_GOV, 4, 1, 4, 000000},
};
// For example.
Reply
#2

Код HTML:
CMD:test(playerid, params[])
{
	new veh = GetPlayerVehicleID(playerid);
	if(IsACopCar(veh))
	{
		SendClientMessage(playerid, -1, "Car is a cop car.");
		return true;
	}
	return true;
}
Reply
#3

Now it doesn't do anything.
Reply
#4

return SendClientMessage(playerid, -1, "Car is a cop car.");

remove the return true;
Reply
#5

Tried that.
Reply
#6

Obviously if you return false it will send the message. ZCMD has been coded so that you can return 0 for the command to act unsuccessful.

You need to check your IsACopCar function; it's obviously returning false when your in an FBI rancher.
Reply
#7

erm........ try that , im not sure if it'll work tho
Код:
stock IsACopCar(vehicleid)
{ 
                new veh = GetPlayerVehicleID(playerid);
		VehicleList[vm - 400][VehType] == VEHICLE_TYPE_GOV;
}
if it doesnt work dont pay attention to it xD
i edited the code again
Reply
#8

pawn Код:
public IsACopCar(vehicleid)
{
    new vm = GetVehicleModel(vehicleid);
    {
        if(VehicleList[vm - 400][VehType] == VEHICLE_TYPE_GOV) return true;
    }
    return 1;
}
returns every car as a cop car.
Reply
#9

pawn Код:
public IsACopCar(vehicleid)
{
    new vm = GetVehicleModel(vehicleid);
    if(vm == 0) return false;
    return (VehicleList[vm - 400][VehType] == VEHICLE_TYPE_GOV);
}
Reply
#10

Nope.
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)