//The Command itself
CMD:veh(playerid, params[])
{
if(GetPVarInt(playerid, "LoggedIn") == 0) return SendClientMessage(playerid, -1, "ERROR: You are not logged in.");
if(Player[playerid][AdminLevel] >= 4)
{
new string[128], vehid, color1, color2;
if(sscanf(params, "iii", vehid, color1, color2)) return SendClientMessage(playerid, -1, "Command Usage: /veh [vehicle id] [color1] [color2]");
{
if(vehid >= 400 || vehid <= 611)
{
new Float:pX, Float:pY, Float:pZ, Float:pA;
GetPlayerPos(playerid, pX, pY, pZ);
GetPlayerFacingAngle(playerid, pA);
CreateVehicle(vehid, pX+5, pY+5, pZ, pA, color1, color2, 180);
format(string, sizeof(string), "[AdminCMD] You have just spawned a %s.", GetVehicleName(vehid));
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
}
else return SendClientMessage(playerid, -1, ADMIN);
return 1;
}
//What the server does when a command actually doesn't exist
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
if(!success)
{
new string[128];
format(string, sizeof(string), "{C0C0C0}The command {FF0000}%s {C0C0C0}does not exist, please use /help.", cmdtext);
SendClientMessage(playerid, -1, string);
}
return 1;
}
CMD:debug(playerid, params[])
{
if(something)
{
printf("debug 1");
something = 1;
printf("debug 2");
something2 = 0
printf("debug 3");
}
else return SendClientMessage(playerid, -1, "blahblah");
printf("debug 4");
return true;
}
|
debug it. For example:
pawn Код:
|
CMD:veh(playerid, params[])
{
if(GetPVarInt(playerid, "LoggedIn") == 0) return SendClientMessage(playerid, -1, "ERROR: You are not logged in.");
if(Player[playerid][AdminLevel] >= 4)
{
new string[128], vehid, color1, color2;
if(sscanf(params, "iii", vehid, color1, color2)) return SendClientMessage(playerid, -1, "Command Usage: /veh [vehicle id] [color1] [color2]");
{
if(vehid >= 400 || vehid <= 611)
{
new Float:pX, Float:pY, Float:pZ, Float:pA;
GetPlayerPos(playerid, pX, pY, pZ);
GetPlayerFacingAngle(playerid, pA);
CreateVehicle(vehid, pX+5, pY+5, pZ, pA, color1, color2, 180);
format(string, sizeof(string), "[AdminCMD] You have just spawned a %s.", GetVehicleName(vehid));
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
}
else
{
SendClientMessage(playerid, -1, ADMIN);
}
return 1;
}
|
I think it's because you're returning a SendClientMessage and a 1, try to remove that return and keep the 1; only. As Blademaster^^ said above.
|
if(vehid >= 400 && vehid <= 611)
CMD:veh(playerid, params[])
{
if(GetPVarInt(playerid, "LoggedIn") == 0) return SendClientMessage(playerid, -1, "ERROR: You are not logged in.");
if(Player[playerid][AdminLevel] >= 4)
{
new string[128], vehid, color1, color2;
if(sscanf(params, "iii", vehid, color1, color2)) return SendClientMessage(playerid, -1, "Command Usage: /veh [vehicle id] [color1] [color2]");
if(vehid >= 400 && vehid <= 611)
{
new Float:pX, Float:pY, Float:pZ, Float:pA;
GetPlayerPos(playerid, pX, pY, pZ);
GetPlayerFacingAngle(playerid, pA);
CreateVehicle(vehid, pX+5, pY+5, pZ, pA, color1, color2, 180);
format(string, sizeof(string), "[AdminCMD] You have just spawned a %s.", GetVehicleName(vehid));
SendClientMessage(playerid, COLOR_WHITE, string);
}
else
{
SendClientMessage(playerid, -1, "Command Usage: /veh [vehicle id] [color1] [color2]");
}
}
else
{
SendClientMessage(playerid, -1, ""ADMIN"");
}
return 1;
}
|
Could you explain it a little more? I don't understand from this example.
|
printf("DEBUG: 1");
|
pawn Код:
#define ADMIN "you are not an admin" Then you should script it as I have done in the message I hope that it will work any feedback would be appreciated!. |
|
What I ment was that you add
pawn Код:
EDIT: Also don't forget to do DEBUG: 1 DEBUG: 2 DEBUG: 3 etc etc.. So you don't just do DEBUG: 1 under each line since that would be impossible to know which one it was |
format(string, sizeof(string), "[AdminCMD] You have just spawned a %s.", GetVehicleName(vehid));
//what "GetVehicleName(vehid)" is
stock GetVehicleName(vehicleid)
{
new string[28];
format(string, sizeof(string), "%s", VehicleNames[GetVehicleModel(vehicleid) - 400]);
return string;
}
//What I have for VehicleNames
new VehicleNames[][] =
{
"Landstalker", "Bravura", "Buffalo", "Linerunner", "Perrenial", "Sentinel",
"Dumper", "Firetruck", "Trashmaster", "Stretch", "Manana", "Infernus",
"Voodoo", "Pony", "Mule", "Cheetah", "Ambulance", "Leviathan", "Moonbeam",
"Esperanto", "Taxi", "Washington", "Bobcat", "Whoopee", "BF Injection",
"Hunter", "Premier", "Enforcer", "Securicar", "Banshee", "Predator", "Bus",
"Rhino", "Barracks", "Hotknife", "Trailer", "Previon", "Coach", "Cabbie",
"Stallion", "Rumpo", "RC Bandit", "Romero", "Packer", "Monster", "Admiral",
"Squalo", "Seasparrow", "Pizzaboy", "Tram", "Trailer", "Turismo", "Speeder",
"Reefer", "Tropic", "Flatbed", "Yankee", "Caddy", "Solair", "Berkley's RC Van",
"Skimmer", "PCJ-600", "Faggio", "Freeway", "RC Baron", "RC Raider", "Glendale",
"Oceanic","Sanchez", "Sparrow", "Patriot", "Quad", "Coastguard", "Dinghy",
"Hermes", "Sabre", "Rustler", "ZR-350", "Walton", "Regina", "Comet", "BMX",
"Burrito", "Camper", "Marquis", "Baggage", "Dozer", "Maverick", "News Chopper",
"Rancher", "FBI Rancher", "Virgo", "Greenwood", "Jetmax", "Hotring", "Sandking",
"Blista Compact", "Police Maverick", "Boxville", "Benson", "Mesa", "RC Goblin",
"Hotring Racer A", "Hotring Racer B", "Bloodring Banger", "Rancher", "Super GT",
"Elegant", "Journey", "Bike", "Mountain Bike", "Beagle", "Cropduster", "Stunt",
"Tanker", "Roadtrain", "Nebula", "Majestic", "Buccaneer", "Shamal", "Hydra",
"FCR-900", "NRG-500", "HPV1000", "Cement Truck", "Tow Truck", "Fortune",
"Cadrona", "FBI Truck", "Willard", "Forklift", "Tractor", "Combine", "Feltzer",
"Remington", "Slamvan", "Blade", "Freight", "Streak", "Vortex", "Vincent",
"Bullet", "Clover", "Sadler", "Firetruck", "Hustler", "Intruder", "Primo",
"Cargobob", "Tampa", "Sunrise", "Merit", "Utility", "Nevada", "Yosemite",
"Windsor", "Monster", "Monster", "Uranus", "Jester", "Sultan", "Stratium",
"Elegy", "Raindance", "RC Tiger", "Flash", "Tahoma", "Savanna", "Bandito",
"Freight Flat", "Streak Carriage", "Kart", "Mower", "Dune", "Sweeper",
"Broadway", "Tornado", "AT-400", "DFT-30", "Huntley", "Stafford", "BF-400",
"News Van", "Tug", "Trailer", "Emperor", "Wayfarer", "Euros", "Hotdog", "Club",
"Freight Box", "Trailer", "Andromada", "Dodo", "RC Cam", "Launch", "Police Car",
"Police Car", "Police Car", "Police Ranger", "Picador", "S.W.A.T", "Alpha",
"Phoenix", "Glendale", "Sadler", "Luggage", "Luggage", "Stairs", "Boxville",
"Tiller", "Utility Trailer"
};
stock GetVehicleName(vehicleid)
{
new string[28];
format(string, sizeof(string), "%s", VehicleNames[GetVehicleModel(vehicleid) - 400]);
return string;
}
#define GetVehicleName(%0) VehicleNames[GetVehicleModel(%0) - 400];
|
Alright, I did that and it ended on this line:
pawn Код:
pawn Код:
pawn Код:
|
CreateVehicle(vehid, pX+5, pY+5, pZ, pA, color1, color2, 180);
format(string, sizeof(string), "[AdminCMD] You have just spawned a %s.", GetVehicleName(vehid));
new veh_ID = CreateVehicle(vehid, pX+5, pY+5, pZ, pA, color1, color2, 180);
format(string, sizeof(string), "[AdminCMD] You have just spawned a %s.", GetVehicleName(veh_ID));
stock GetVehicleName(vehicleid)
{
new string[28] = "N/A";
if (GetVehicleModel(vehicleid)) strcat((string[0] = '\0', string), VehicleNames[GetVehicleModel(vehicleid) - 400], sizeof (string));
return string;
}
CMD:veh(playerid, params[])
{
new vehid, color1, color2;
if(GetPVarInt(playerid, "LoggedIn") == 0) return SendClientMessage(playerid, -1, "ERROR: You are not logged in.");
if(Player[playerid][AdminLevel] < 4) return SendClientMessage(playerid, -1, "ERROR: Admin 4+!");
if(sscanf(params, "iii", vehid, color1, color2)) return SendClientMessage(playerid, -1, "Command Usage: /veh [vehicle id] [color1] [color2]");
if(400 < (vehid) > 611) return SendClientMessage(playerid, -1, "ERROR: For vehicle id use from 400 to 611!");
else
{
new string[128], Float:p[4];
GetPlayerPos(playerid, p[0], p[1], p[2]);
GetPlayerFacingAngle(playerid, p[3]);
CreateVehicle(vehid, p[0]+5, p[1]+5, p[2], p[3], color1, color2, 180);
format(string, sizeof(string), "[AdminCMD] You have just spawned a vehicle.");
SendClientMessage(playerid, COLOR_WHITE, string);
}
return 1;
}
|
pawn Код:
Change to: pawn Код:
pawn Код:
|