Division cmd not working
#1

What wrong with this code, when i use this cmd does not happen anything. Can anyone help me to fix this issues?
This is the code of /lvpddiv command
Код:
CMD:lvpddiv(playerid, params[])
{
	if(PlayerInfo[playerid][pMember] == 14 || PlayerInfo[playerid][pLeader] == 14 && PlayerInfo[playerid][pRank] >= 5)
	{
		new string[128], giveplayerid, division, type;
		if(sscanf(params, "ud", giveplayerid, division))
		{
			SendClientMessageEx(playerid, COLOR_WHITE, "Gunakan: /lvpddiv [playerid] [divisi]");
			SendClientMessageEx(playerid, COLOR_GRAD2, "Divisi: 1 (Tidak ada), 2 (II), 3 (FTO), 4 (IA), 5 (SWAT)");
			return 1;
		}

		if (PlayerInfo[playerid][pRank] >= 5)
		{
			if(IsPlayerConnected(giveplayerid))
			{
				if(PlayerInfo[playerid][pMember] == 1)
				{
					switch(type)
					{
						case 1:
						{
							PlayerInfo[giveplayerid][pDivisi] = 1;
							format(string, sizeof(string), "%s telah memberimu Divisi Polantas.", GetPlayerNameEx(playerid));
							SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
							format(string, sizeof(string), "Kamu telah memberikan Divisi Polantas kepada %s.", GetPlayerNameEx(giveplayerid));
							SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
						}
						case 2:
						{
							PlayerInfo[giveplayerid][pDivisi] = 2;
							format(string, sizeof(string), "%s telah memberimu Divisi I.", GetPlayerNameEx(playerid));
							SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
							format(string, sizeof(string), "Kamu telah memberikan Divisi I kepada %s.", GetPlayerNameEx(giveplayerid));
							SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
						}
						case 3:
						{
							PlayerInfo[giveplayerid][pDivisi] = 3;
							format(string, sizeof(string), "%s telah memberimu Divisi II.", GetPlayerNameEx(playerid));
							SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
							format(string, sizeof(string), "Kamu telah memberikan Divisi II kepada %s.", GetPlayerNameEx(giveplayerid));
							SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
						}
						case 4:
						{
							PlayerInfo[giveplayerid][pDivisi] = 4;
							format(string, sizeof(string), "%s telah memberimu Divisi IA.", GetPlayerNameEx(playerid));
							SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
							format(string, sizeof(string), "Kamu telah memberikan Divisi IA kepada %s.", GetPlayerNameEx(giveplayerid));
							SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
						}
						case 5:
						{
							PlayerInfo[giveplayerid][pDivisi] = 5;
							format(string, sizeof(string), "%s telah memberimu Divisi SWAT.", GetPlayerNameEx(playerid));
							SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
							format(string, sizeof(string), "Kamu telah memberikan Divisi SWAT kepada %s.", GetPlayerNameEx(giveplayerid));
							SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
						}
					}
				}
			}
		}
		else
		{
			SendClientMessageEx(playerid, COLOR_GRAD1, "Kamu tidak dapat menggunakan perintah tersebut - minimal Rank 5 untuk menggunakan perintah itu.");
		}
	}
	return 1;
}
Reply
#2

Quote:
Originally Posted by Jassey
Посмотреть сообщение
What wrong with this code, when i use this cmd does not happen anything. Can anyone help me to fix this issues?
This is the code of /lvpddiv command
Код:
CMD:lvpddiv(playerid, params[])
{
	if(PlayerInfo[playerid][pMember] == 14 || PlayerInfo[playerid][pLeader] == 14 && PlayerInfo[playerid][pRank] >= 5)
	{
		new string[128], giveplayerid, division, type;
		if(sscanf(params, "ud", giveplayerid, division))
		{
			SendClientMessageEx(playerid, COLOR_WHITE, "Gunakan: /lvpddiv [playerid] [divisi]");
			SendClientMessageEx(playerid, COLOR_GRAD2, "Divisi: 1 (Tidak ada), 2 (II), 3 (FTO), 4 (IA), 5 (SWAT)");
			return 1;
		}

		if (PlayerInfo[playerid][pRank] >= 5)
		{
			if(IsPlayerConnected(giveplayerid))
			{
				if(PlayerInfo[playerid][pMember] == 1)
				{
					switch(type)
					{
						case 1:
						{
							PlayerInfo[giveplayerid][pDivisi] = 1;
							format(string, sizeof(string), "%s telah memberimu Divisi Polantas.", GetPlayerNameEx(playerid));
							SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
							format(string, sizeof(string), "Kamu telah memberikan Divisi Polantas kepada %s.", GetPlayerNameEx(giveplayerid));
							SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
						}
						case 2:
						{
							PlayerInfo[giveplayerid][pDivisi] = 2;
							format(string, sizeof(string), "%s telah memberimu Divisi I.", GetPlayerNameEx(playerid));
							SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
							format(string, sizeof(string), "Kamu telah memberikan Divisi I kepada %s.", GetPlayerNameEx(giveplayerid));
							SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
						}
						case 3:
						{
							PlayerInfo[giveplayerid][pDivisi] = 3;
							format(string, sizeof(string), "%s telah memberimu Divisi II.", GetPlayerNameEx(playerid));
							SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
							format(string, sizeof(string), "Kamu telah memberikan Divisi II kepada %s.", GetPlayerNameEx(giveplayerid));
							SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
						}
						case 4:
						{
							PlayerInfo[giveplayerid][pDivisi] = 4;
							format(string, sizeof(string), "%s telah memberimu Divisi IA.", GetPlayerNameEx(playerid));
							SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
							format(string, sizeof(string), "Kamu telah memberikan Divisi IA kepada %s.", GetPlayerNameEx(giveplayerid));
							SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
						}
						case 5:
						{
							PlayerInfo[giveplayerid][pDivisi] = 5;
							format(string, sizeof(string), "%s telah memberimu Divisi SWAT.", GetPlayerNameEx(playerid));
							SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
							format(string, sizeof(string), "Kamu telah memberikan Divisi SWAT kepada %s.", GetPlayerNameEx(giveplayerid));
							SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
						}
					}
				}
			}
		}
		else
		{
			SendClientMessageEx(playerid, COLOR_GRAD1, "Kamu tidak dapat menggunakan perintah tersebut - minimal Rank 5 untuk menggunakan perintah itu.");
		}
	}
	return 1;
}
Try using this one. IT "might" work, notic i sayd "might" i'm not 100% sure.


Код:
CMD:lspddiv(playerid, params[])
{
	if(IsACop(playerid))
	{
		new string[128], giveplayerid, division;
		if(sscanf(params, "ud", giveplayerid, division))
		{
			SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /lspddiv [player] [division]");
			SendClientMessageEx(playerid, COLOR_GRAD2, "Available division names: 1 (None), 2 (DET), 3 (FTO), 4 (IA), 5 (SWAT), 6 (HSIU)");
			return 1;
		}

		if (PlayerInfo[playerid][pRank] >= 4)
		{
			if(IsPlayerConnected(giveplayerid))
			{
				if(PlayerInfo[playerid][pMember] == 1)
				{
					if(division == 3)
					{
						PlayerInfo[giveplayerid][pDivision] = 3;
						format(string, sizeof(string), "You are now in the FTO division, invited by %s.", GetPlayerNameEx(playerid));
						SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "You have invited %s into the FTO division.", GetPlayerNameEx(giveplayerid));
						SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
					}
					else if(division == 2)
					{
						PlayerInfo[giveplayerid][pDivision] = 2;
						format(string, sizeof(string), "You are now in the DET division, invited by %s.", GetPlayerNameEx(playerid));
						SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "You have invited %s to join the DET division.", GetPlayerNameEx(giveplayerid));
						SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
					}
					else if(division == 4)
					{
						PlayerInfo[giveplayerid][pDivision] = 4;
						format(string, sizeof(string), "You are now in the IA division, invited by %s.", GetPlayerNameEx(playerid));
						SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "You have invited %s to join the IA division.", GetPlayerNameEx(giveplayerid));
						SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
					}
					else if(division == 5)
					{
						PlayerInfo[giveplayerid][pDivision] = 5;
						format(string, sizeof(string), "You are now in the SWAT division, invited by %s.", GetPlayerNameEx(playerid));
						SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "You have invited %s to join the SWAT division.", GetPlayerNameEx(giveplayerid));
						SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
					}
					else if(division == 6)
					{
						PlayerInfo[giveplayerid][pDivision] = 6;
						format(string, sizeof(string), "You are now in the HSIU division, invited by %s.", GetPlayerNameEx(playerid));
						SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "You have invited %s to join the HSIU division.", GetPlayerNameEx(giveplayerid));
						SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
					}
					else if(division == 1)
					{
						PlayerInfo[giveplayerid][pDivision] = 1;
						format(string, sizeof(string), "You have been kicked from your division by %s.", GetPlayerNameEx(playerid));
						SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "You have kicked %s out of their division.", GetPlayerNameEx(giveplayerid));
						SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
					}
				}

			}
		}
		else
		{
			SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command - only R4+ can do this.");
		}
	}
	return 1;
}
Reply
#3

How About This Script..?
Quote:

CMDervice(playerid, params[])
{
new string[128], choice[32];
if(sscanf(params, "s[32]", choice))
{
SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /service [name]");
SendClientMessageEx(playerid, COLOR_GREY, "Available names: Taxi, Bus, Medic, Mechanic, 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,"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;
}
}

Help Me please
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)