SA-MP Forums Archive
[HELP] 2 Errors - 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] 2 Errors (/showthread.php?tid=569017)



[HELP] 2 Errors - NexisHotel - 27.03.2015

Код:
Command Error: ..\PGRP.pwn(77786) : error 035: argument type mismatch (argument 2)
Код:
CMD:service(playerid, params[])
{
	new string[128], string2[128], choice[32];
	if(sscanf(params, "s[32]", choice))
	{
		SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /service [name]");
		SendClientMessageEx(playerid, COLOR_GREY, "Available names: RR, Taxi, Bus, EMS");
		return 1;
	}

	if(PlayerInfo[playerid][pJailed] > 0)
	{
		SendClientMessageEx(playerid, COLOR_WHITE, "You cannot use this in jail/prison.");
		return 1;
	}
	if(PlayerInfo[playerid][pServiceTime] > 0) return SendClientMessage(playerid, COLOR_WHITE, "You must wait 30 seconds before using this command again. " );

    if(strcmp(choice,"rr",true) == 0)
	{
		format(string, sizeof(string), "Repair\nRefuel\nTow");
		ShowPlayerDialog(playerid, DIALOG_CHOOSINGFIX, DIALOG_STYLE_LIST, "{33CCFF}What type of assistance are you requiring?", string, "Select", "Cancel");
		SetPVarInt(playerid, "ChoosingFix", 1);
		return 1;
	}
	else if(strcmp(choice,"ems",true) == 0)
	{
		if(GetPVarInt(playerid, "Injured") == 0)
		{
			SendClientMessageEx(playerid, COLOR_GREY, "   You are not injured, you can't call for EMS now!");
			return 1;
		}
		new zone[MAX_ZONE_NAME];
		GetPlayer2DZone(playerid, zone, MAX_ZONE_NAME);
		SetPVarInt(playerid, "EMSAttempt", 1);
		SendClientMessageEx(playerid, COLOR_WHITE, "The EMS have been informed of your current location and are on their way.");
		format(string, sizeof(string), "Emergency Dispatch has reported (%d) %s to be wounded at %s, They require immediate emergency transport.",playerid, GetPlayerNameEx(playerid), zone);
		SendRadioMessage(4, TEAM_MED_COLOR, string);
		SendDivisionMessage(12, 3, TEAM_MED_COLOR, string);
		PlayerInfo[playerid][pServiceTime] = 30;
		return 1;
	}
	else if(strcmp(choice,"taxi",true) == 0)
	{
		if(TaxiDrivers < 1)
		{
			SendClientMessageEx(playerid, COLOR_GREY, "   There are no taxi drivers on duty at the moment, try again later!");
			return 1;
		}
		if(TransportDuty[playerid] > 0)
		{
			SendClientMessageEx(playerid, COLOR_GREY, "   You can't call for a taxi now!");
			return 1;
		}
		format(string, sizeof(string), "** %s is in need of a taxi driver - use /accept taxi to accept the call.", GetPlayerNameEx(playerid));
		SendFamilyMessage(10, TEAM_AZTECAS_COLOR, string);
		SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* You have called for a taxi driver, wait for a reply.");
		TaxiCall = playerid;
		PlayerInfo[playerid][pServiceTime] = 30;
		return 1;
	}
	else if(strcmp(choice,"bus",true) == 0)
	{
		if(BusDrivers < 1)
		{
			SendClientMessageEx(playerid, COLOR_GREY, "   There are no bus drivers at the moment, try again later!");
			return 1;
		}
		if(TransportDuty[playerid] > 0)
		{
			SendClientMessageEx(playerid, COLOR_GREY, "   You can't call for a bus now!");
			return 1;
		}
		format(string, sizeof(string), "** %s is in need of a bus driver - use /accept bus to accept the call.", GetPlayerNameEx(playerid));
		SendJobMessage(14, TEAM_AZTECAS_COLOR, string);
		SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* You have called for a bus driver, wait for a reply.");
		BusCall = playerid;
		PlayerInfo[playerid][pServiceTime] = 30;
		return 1;
	}
	else if(strcmp(choice,"medic",true) == 0)
	{
		if(Medics < 1)
		{
			SendClientMessageEx(playerid, COLOR_GREY, "   There are no medics on duty at the moment, try again later!");
			return 1;
		}
		format(string, sizeof(string), "** %s is in need of a Medic - use /accept medic to accept the call.", GetPlayerNameEx(playerid));
		SendRadioMessage(4, TEAM_AZTECAS_COLOR, string);
		SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* You have called for a medic, wait for a reply.");
		MedicCall = playerid;
		PlayerInfo[playerid][pServiceTime] = 30;
		return 1;
	}
	else if(strcmp(choice,"mechanic",true) == 0)
	{
		if(Mechanics < 1)
		{
			SendClientMessageEx(playerid, COLOR_GREY, "   There are no car mechanics on duty at the moment, try again later!");
			return 1;
		}
		format(string, sizeof(string), "** %s is in need of a car mechanic - use /accept mechanic to accept the call.", GetPlayerNameEx(playerid));
		SendJobMessage(7, TEAM_AZTECAS_COLOR, string);
		SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* You have called for a car mechanic, wait for a reply.");
		MechanicCall = playerid;
		PlayerInfo[playerid][pServiceTime] = 30;
		return 1;
	}
	else
	{
		SendClientMessageEx(playerid, COLOR_GREY, "   Unknown service name!");
		return 1;
	}
}
__________________________________________________ _____

Код:
Dialog Error: ../PGRP.pwn(88942) : error 029: invalid expression, assumed zero
Код:
if(dialogid == DIALOG_CHOOSINGFIX)
	{
	    if(response)
	    {
			new zone[MAX_ZONE_NAME];
			new Float:x, Float:y, Float:z;
			GetPlayer2DZone(playerid, zone, MAX_ZONE_NAME);
		    if(listitem == 0)
			{
				GetPlayerPos(playerid, x, y, z);
				format(string, sizeof(string), "____________ RR DISPATCH PANEL _____________", PlayerInfo[playerid][pPnumber]);
				SendRadioMessage(14, COLOR_YELLOW, string);
				format(string, sizeof(string), "REQUESTING: {FFFFFF}Repair");
				SendRadioMessage(14, COLOR_YELLOW, string);
				format(string, sizeof(string), "DESTINATION: {FFFFFF}%s", zone);
				SendRadioMessage(14, COLOR_YELLOW, string);
				format(string, sizeof(string), "PHONE NUMBER: {FFFFFF}%i", PlayerInfo[playerid][pPnumber]);
				SendRadioMessage(14, COLOR_YELLOW, string);
				format(string, sizeof(string), "____________________________________________", PlayerInfo[playerid][pPnumber]);
				SendRadioMessage(14, COLOR_YELLOW, string);
				format(string, sizeof(string), "To accept this service request; (type /arapid %d)", playerid);
				SendRadioMessage(14, COLOR_WHITE, string);

				/*foreach(Player, i)
				{
					if(PlayerInfo[i][pJob] == 30 || PlayerInfo[i][pJob2] == 30)
					{
					SendClientMessageEx(i, COLOR_YELLOW, string2);
					SendClientMessageEx(i, COLOR_YELLOW, string3);
					SendClientMessageEx(i, COLOR_YELLOW, string4);
					SendClientMessageEx(i, COLOR_YELLOW, string5);
					}
				}*/

				DeletePVar(playerid, "ChoosingFix");
				SetPVarInt(playerid, "RRCaller", 1);
				RRCall[playerid] = playerid;
				PlayerInfo[playerid][pServiceTime] = 30;
				SendClientMessageEx(playerid, COLOR_WHITE, "A rapid-recovery worker will be dispatched to your current location within a few minutes");
		    }
		    else if(listitem == 1)
		    {
				GetPlayerPos(playerid, x, y, z);
				format(string, sizeof(string), "____________ RR DISPATCH PANEL _____________", PlayerInfo[playerid][pPnumber]);
				SendRadioMessage(14, COLOR_YELLOW, string);
				format(string, sizeof(string), "REQUESTING: {FFFFFF}Refuel");
				SendRadioMessage(14, COLOR_YELLOW, string);
				format(string, sizeof(string), "DESTINATION: {FFFFFF}%s", zone);
				SendRadioMessage(14, COLOR_YELLOW, string);
				format(string, sizeof(string), "PHONE NUMBER: {FFFFFF}%i", PlayerInfo[playerid][pPnumber]);
				SendRadioMessage(14, COLOR_YELLOW, string);
				format(string, sizeof(string), "____________________________________________", PlayerInfo[playerid][pPnumber]);
				SendRadioMessage(14, COLOR_YELLOW, string);
				format(string, sizeof(string), "To accept this service request; (type /arapid %d)", playerid);
				SendRadioMessage(14, COLOR_WHITE, string);

				/*foreach(Player, i)
				{
					if(PlayerInfo[i][pJob] == 30 || PlayerInfo[i][pJob2] == 30)
					{
					SendClientMessageEx(i, COLOR_YELLOW, string2);
					SendClientMessageEx(i, COLOR_YELLOW, string3);
					SendClientMessageEx(i, COLOR_YELLOW, string4);
					SendClientMessageEx(i, COLOR_YELLOW, string5);
					}
				}*/

				DeletePVar(playerid, "ChoosingFix");
				SetPVarInt(playerid, "RRCaller", 1);
				RRCall[playerid] = playerid;
				PlayerInfo[playerid][pServiceTime] = 30;
				SendClientMessageEx(playerid, COLOR_WHITE, "A rapid-recovery worker will be dispatched to your current location within a few minutes");
			}
		    else if(listitem == 2)
		    {
				GetPlayerPos(playerid, x, y, z);
				format(string, sizeof(string), "____________ RR DISPATCH PANEL _____________", PlayerInfo[playerid][pPnumber]);
				SendRadioMessage(14, COLOR_YELLOW, string);
				format(string, sizeof(string), "REQUESTING: {FFFFFF}Tow");
				SendRadioMessage(14, COLOR_YELLOW, string);
				format(string, sizeof(string), "DESTINATION: {FFFFFF}%s", zone);
				SendRadioMessage(14, COLOR_YELLOW, string);
				format(string, sizeof(string), "PHONE NUMBER: {FFFFFF}%i", PlayerInfo[playerid][pPnumber]);
				SendRadioMessage(14, COLOR_YELLOW, string);
				format(string, sizeof(string), "____________________________________________", PlayerInfo[playerid][pPnumber]);
				SendRadioMessage(14, COLOR_YELLOW, string);
				format(string, sizeof(string), "To accept this service request; (type /arapid %d)", playerid);
				SendRadioMessage(14, COLOR_WHITE, string);

				/*foreach(Player, i)
				{
					if(PlayerInfo[i][pJob] == 30 || PlayerInfo[i][pJob2] == 30)
					{
					SendClientMessageEx(i, COLOR_YELLOW, string2);
					SendClientMessageEx(i, COLOR_YELLOW, string3);
					SendClientMessageEx(i, COLOR_YELLOW, string4);
					SendClientMessageEx(i, COLOR_YELLOW, string5);
					}
				}*/

				DeletePVar(playerid, "ChoosingFix");
				SetPVarInt(playerid, "RRCaller", 1);
				RRCall[playerid] = playerid;
				PlayerInfo[playerid][pServiceTime] = 30;
				SendClientMessageEx(playerid, COLOR_WHITE, "A rapid-recovery worker will be dispatched to your current location within a few minutes");
			}
		}
		else
		{
		    DeletePVar(playerid, "ChoosingFix");
			return 0;
		}
	}



Re: [HELP] 2 Errors - Fantje - 27.03.2015

Please can you show the error lines? Mark it red or something


Re: [HELP] 2 Errors - NexisHotel - 27.03.2015

Quote:
Originally Posted by NexisHotel
Посмотреть сообщение
Код:
Command Error: ..\PGRP.pwn(77786) : error 035: argument type mismatch (argument 2)
Код:
CMD:service(playerid, params[])
{
	new string[128], string2[128], choice[32];
	if(sscanf(params, "s[32]", choice))
	{
		SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /service [name]");
		SendClientMessageEx(playerid, COLOR_GREY, "Available names: RR, Taxi, Bus, EMS");
		return 1;
	}

	if(PlayerInfo[playerid][pJailed] > 0)
	{
		SendClientMessageEx(playerid, COLOR_WHITE, "You cannot use this in jail/prison.");
		return 1;
	}
	if(PlayerInfo[playerid][pServiceTime] > 0) return SendClientMessage(playerid, COLOR_WHITE, "You must wait 30 seconds before using this command again. " );

    if(strcmp(choice,"rr",true) == 0)
	{
		format(string, sizeof(string), "Repair\nRefuel\nTow");
		ShowPlayerDialog(playerid, DIALOG_CHOOSINGFIX, DIALOG_STYLE_LIST, "{33CCFF}What type of assistance are you requiring?", string, "Select", "Cancel");
		SetPVarInt(playerid, "ChoosingFix", 1);
		return 1;
	}
	else if(strcmp(choice,"ems",true) == 0)
	{
		if(GetPVarInt(playerid, "Injured") == 0)
		{
			SendClientMessageEx(playerid, COLOR_GREY, "   You are not injured, you can't call for EMS now!");
			return 1;
		}
		new zone[MAX_ZONE_NAME];
		GetPlayer2DZone(playerid, zone, MAX_ZONE_NAME);
		SetPVarInt(playerid, "EMSAttempt", 1);
		SendClientMessageEx(playerid, COLOR_WHITE, "The EMS have been informed of your current location and are on their way.");
		format(string, sizeof(string), "Emergency Dispatch has reported (%d) %s to be wounded at %s, They require immediate emergency transport.",playerid, GetPlayerNameEx(playerid), zone);
		SendRadioMessage(4, TEAM_MED_COLOR, string);
		SendDivisionMessage(12, 3, TEAM_MED_COLOR, string);
		PlayerInfo[playerid][pServiceTime] = 30;
		return 1;
	}
	else if(strcmp(choice,"taxi",true) == 0)
	{
		if(TaxiDrivers < 1)
		{
			SendClientMessageEx(playerid, COLOR_GREY, "   There are no taxi drivers on duty at the moment, try again later!");
			return 1;
		}
		if(TransportDuty[playerid] > 0)
		{
			SendClientMessageEx(playerid, COLOR_GREY, "   You can't call for a taxi now!");
			return 1;
		}
		format(string, sizeof(string), "** %s is in need of a taxi driver - use /accept taxi to accept the call.", GetPlayerNameEx(playerid));
		SendFamilyMessage(10, TEAM_AZTECAS_COLOR, string);
		SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* You have called for a taxi driver, wait for a reply.");
		TaxiCall = playerid;
		PlayerInfo[playerid][pServiceTime] = 30;
		return 1;
	}
	else if(strcmp(choice,"bus",true) == 0)
	{
		if(BusDrivers < 1)
		{
			SendClientMessageEx(playerid, COLOR_GREY, "   There are no bus drivers at the moment, try again later!");
			return 1;
		}
		if(TransportDuty[playerid] > 0)
		{
			SendClientMessageEx(playerid, COLOR_GREY, "   You can't call for a bus now!");
			return 1;
		}
		format(string, sizeof(string), "** %s is in need of a bus driver - use /accept bus to accept the call.", GetPlayerNameEx(playerid));
		SendJobMessage(14, TEAM_AZTECAS_COLOR, string);
		SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* You have called for a bus driver, wait for a reply.");
		BusCall = playerid;
		PlayerInfo[playerid][pServiceTime] = 30;
		return 1;
	}
	else if(strcmp(choice,"medic",true) == 0)
	{
		if(Medics < 1)
		{
			SendClientMessageEx(playerid, COLOR_GREY, "   There are no medics on duty at the moment, try again later!");
			return 1;
		}
		format(string, sizeof(string), "** %s is in need of a Medic - use /accept medic to accept the call.", GetPlayerNameEx(playerid));
		SendRadioMessage(4, TEAM_AZTECAS_COLOR, string);
		SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* You have called for a medic, wait for a reply.");
		MedicCall = playerid;
		PlayerInfo[playerid][pServiceTime] = 30;
		return 1;
	}
	else if(strcmp(choice,"mechanic",true) == 0)
	{
		if(Mechanics < 1)
		{
			SendClientMessageEx(playerid, COLOR_GREY, "   There are no car mechanics on duty at the moment, try again later!");
			return 1;
		}
		format(string, sizeof(string), "** %s is in need of a car mechanic - use /accept mechanic to accept the call.", GetPlayerNameEx(playerid));
		SendJobMessage(7, TEAM_AZTECAS_COLOR, string);
		SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* You have called for a car mechanic, wait for a reply.");
		MechanicCall = playerid;
		PlayerInfo[playerid][pServiceTime] = 30;
		return 1;
	}
	else
	{
		SendClientMessageEx(playerid, COLOR_GREY, "   Unknown service name!");
		return 1;
	}
}
__________________________________________________ _____

Код:
Dialog Error: ../PGRP.pwn(88942) : error 029: invalid expression, assumed zero
Код:
if(dialogid == DIALOG_CHOOSINGFIX)
	{
	    if(response)
	    {
			new zone[MAX_ZONE_NAME];
			new Float:x, Float:y, Float:z;
			GetPlayer2DZone(playerid, zone, MAX_ZONE_NAME);
		    if(listitem == 0)
			{
				GetPlayerPos(playerid, x, y, z);
				format(string, sizeof(string), "____________ RR DISPATCH PANEL _____________", PlayerInfo[playerid][pPnumber]);
				SendRadioMessage(14, COLOR_YELLOW, string);
				format(string, sizeof(string), "REQUESTING: {FFFFFF}Repair");
				SendRadioMessage(14, COLOR_YELLOW, string);
				format(string, sizeof(string), "DESTINATION: {FFFFFF}%s", zone);
				SendRadioMessage(14, COLOR_YELLOW, string);
				format(string, sizeof(string), "PHONE NUMBER: {FFFFFF}%i", PlayerInfo[playerid][pPnumber]);
				SendRadioMessage(14, COLOR_YELLOW, string);
				format(string, sizeof(string), "____________________________________________", PlayerInfo[playerid][pPnumber]);
				SendRadioMessage(14, COLOR_YELLOW, string);
				format(string, sizeof(string), "To accept this service request; (type /arapid %d)", playerid);
				SendRadioMessage(14, COLOR_WHITE, string);

				/*foreach(Player, i)
				{
					if(PlayerInfo[i][pJob] == 30 || PlayerInfo[i][pJob2] == 30)
					{
					SendClientMessageEx(i, COLOR_YELLOW, string2);
					SendClientMessageEx(i, COLOR_YELLOW, string3);
					SendClientMessageEx(i, COLOR_YELLOW, string4);
					SendClientMessageEx(i, COLOR_YELLOW, string5);
					}
				}*/

				DeletePVar(playerid, "ChoosingFix");
				SetPVarInt(playerid, "RRCaller", 1);
				RRCall[playerid] = playerid;
				PlayerInfo[playerid][pServiceTime] = 30;
				SendClientMessageEx(playerid, COLOR_WHITE, "A rapid-recovery worker will be dispatched to your current location within a few minutes");
		    }
		    else if(listitem == 1)
		    {
				GetPlayerPos(playerid, x, y, z);
				format(string, sizeof(string), "____________ RR DISPATCH PANEL _____________", PlayerInfo[playerid][pPnumber]);
				SendRadioMessage(14, COLOR_YELLOW, string);
				format(string, sizeof(string), "REQUESTING: {FFFFFF}Refuel");
				SendRadioMessage(14, COLOR_YELLOW, string);
				format(string, sizeof(string), "DESTINATION: {FFFFFF}%s", zone);
				SendRadioMessage(14, COLOR_YELLOW, string);
				format(string, sizeof(string), "PHONE NUMBER: {FFFFFF}%i", PlayerInfo[playerid][pPnumber]);
				SendRadioMessage(14, COLOR_YELLOW, string);
				format(string, sizeof(string), "____________________________________________", PlayerInfo[playerid][pPnumber]);
				SendRadioMessage(14, COLOR_YELLOW, string);
				format(string, sizeof(string), "To accept this service request; (type /arapid %d)", playerid);
				SendRadioMessage(14, COLOR_WHITE, string);

				/*foreach(Player, i)
				{
					if(PlayerInfo[i][pJob] == 30 || PlayerInfo[i][pJob2] == 30)
					{
					SendClientMessageEx(i, COLOR_YELLOW, string2);
					SendClientMessageEx(i, COLOR_YELLOW, string3);
					SendClientMessageEx(i, COLOR_YELLOW, string4);
					SendClientMessageEx(i, COLOR_YELLOW, string5);
					}
				}*/

				DeletePVar(playerid, "ChoosingFix");
				SetPVarInt(playerid, "RRCaller", 1);
				RRCall[playerid] = playerid;
				PlayerInfo[playerid][pServiceTime] = 30;
				SendClientMessageEx(playerid, COLOR_WHITE, "A rapid-recovery worker will be dispatched to your current location within a few minutes");
			}
		    else if(listitem == 2)
		    {
				GetPlayerPos(playerid, x, y, z);
				format(string, sizeof(string), "____________ RR DISPATCH PANEL _____________", PlayerInfo[playerid][pPnumber]);
				SendRadioMessage(14, COLOR_YELLOW, string);
				format(string, sizeof(string), "REQUESTING: {FFFFFF}Tow");
				SendRadioMessage(14, COLOR_YELLOW, string);
				format(string, sizeof(string), "DESTINATION: {FFFFFF}%s", zone);
				SendRadioMessage(14, COLOR_YELLOW, string);
				format(string, sizeof(string), "PHONE NUMBER: {FFFFFF}%i", PlayerInfo[playerid][pPnumber]);
				SendRadioMessage(14, COLOR_YELLOW, string);
				format(string, sizeof(string), "____________________________________________", PlayerInfo[playerid][pPnumber]);
				SendRadioMessage(14, COLOR_YELLOW, string);
				format(string, sizeof(string), "To accept this service request; (type /arapid %d)", playerid);
				SendRadioMessage(14, COLOR_WHITE, string);

				/*foreach(Player, i)
				{
					if(PlayerInfo[i][pJob] == 30 || PlayerInfo[i][pJob2] == 30)
					{
					SendClientMessageEx(i, COLOR_YELLOW, string2);
					SendClientMessageEx(i, COLOR_YELLOW, string3);
					SendClientMessageEx(i, COLOR_YELLOW, string4);
					SendClientMessageEx(i, COLOR_YELLOW, string5);
					}
				}*/

				DeletePVar(playerid, "ChoosingFix");
				SetPVarInt(playerid, "RRCaller", 1);
				RRCall[playerid] = playerid;
				PlayerInfo[playerid][pServiceTime] = 30;
				SendClientMessageEx(playerid, COLOR_WHITE, "A rapid-recovery worker will be dispatched to your current location within a few minutes");
			}
		}
		else
		{
		    DeletePVar(playerid, "ChoosingFix");
			return 0;
		}
	}
I marked them as RED


Re: [HELP] 2 Errors - CalvinC - 27.03.2015

Show how you define "DIALOG_CHOOSINGFIX".


Re: [HELP] 2 Errors - NexisHotel - 27.03.2015

Ohh Thanks CalvinC for telling me that one I see that i was wrong in my define. Big thanks for that mate.

Now my only problem is the Command Error.


Re: [HELP] 2 Errors - fuckingcruse - 27.03.2015

#edit he got the solution ..


Re: [HELP] 2 Errors - NexisHotel - 27.03.2015

Oh well since the DIALOG for CHOOSING FIX is connected to CMD Error, The CMD is now fixed too! Both are fixed. Reputation to CalvinC for telling me about DIALOG Define Good one mate.


Re: [HELP] 2 Errors - NexisHotel - 27.03.2015

This topic can be lock now , Since problem is SOLVED