SA-MP Forums Archive
Help with command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help with command (/showthread.php?tid=419874)



Help with command - Yako - 02.03.2013

Hello, what's wrong here? When I am not a cop it's okay it says "You're not a cop" when you are not on duty it's also okay. But when you are on duty it says Undefined command

Код:
CMD:speedgun(playerid,params[])
{
	if(!IsACop(playerid)) return SendClientMessage(playerid, COLOR_ERROR, "You are not a cop!");
	if(copduty[playerid] == 0) return SendClientMessage(playerid, COLOR_ERROR, "You are not on duty!");
	new string[256];
 	for(new i = 0; i < MAX_PLAYERS; i++)
 	{
 	new vehicleid,Float:speed_x,Float:speed_y,Float:speed_z,Float:final_speed,final_speed_int;
	vehicleid = GetPlayerVehicleID(i);
	GetVehicleVelocity(vehicleid, speed_x, speed_y, speed_z);
	final_speed = floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*86.4166672;
	final_speed_int = floatround(final_speed, floatround_round);
	format(string, sizeof(string), "%s\n%s - %d MPH\n", string, GetVehicleName(vehicleid), final_speed_int);
	}
	ShowPlayerDialog(playerid, DIALOG_SPEEDGUN, DIALOG_STYLE_LIST, "Speed Gun", string, "OK", "");
	return 1;
}



Re: Help with command - KeenanRitchie - 02.03.2013

Try this
depending on you'r script setup

Код:
if(PlayerInfo[pcopduty] == 0) return SendClientMessage(playerid, COLOR_ERROR, "You are not on duty!");


Or   [copduty]



Re: Help with command - Yako - 02.03.2013

Thats not sulution


Re: Help with command - Catalyst- - 02.03.2013

Try replacing "GetVehicleName(vehicleid)" with "GetVehicleName(GetVehicleModel(vehicleid))".
This is just a guess as I can't see how your function works.