/apark, /aimpound help.
#1

Say I had a normal "NGG edit". How would I script a /apark, and /aimpound? Remember, NGG is scripted in ZCMD.
Reply
#2

Show me the commands /park and /impound that already exists on the script, I'm not familiar nor have ever touched an NG-RP script.
Reply
#3

Code:
CMD:park(playerid, params[])
{
	if(PlayerInfo[playerid][pVehicleKeysFrom] != INVALID_PLAYER_ID)
	{
		new ownerid = PlayerInfo[playerid][pVehicleKeysFrom];
		if(IsPlayerConnected(ownerid))
		{
			new d = PlayerInfo[playerid][pVehicleKeys];
			if(IsPlayerInVehicle(playerid, PlayerVehicleInfo[ownerid][d][pvId]))
			{
			    if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessageEx(playerid, COLOR_GREY, "You must be in the driver seat.");
				new Float:x, Float:y, Float:z, Float:angle, Float:health;
				GetVehicleHealth(PlayerVehicleInfo[ownerid][d][pvId], health);
				if(health < 800) return SendClientMessageEx(playerid, COLOR_GREY, " Your vehicle is too damaged to park it.");
				if(PlayerInfo[playerid][pLockCar] == GetPlayerVehicleID(playerid)) PlayerInfo[playerid][pLockCar] = INVALID_VEHICLE_ID;
				if(IsARC(GetPlayerVehicleID(playerid))) // RC Vehicles
				{
					new Float:vehPos[3];
					GetVehiclePos(GetPlayerVehicleID(playerid),vehPos[0], vehPos[1], vehPos[2]);
					SetPlayerPos(playerid,vehPos[0], vehPos[1]+0.5, vehPos[2]+0.5);
				}
				GetVehiclePos(PlayerVehicleInfo[ownerid][d][pvId], x, y, z);
				GetVehicleZAngle(PlayerVehicleInfo[ownerid][d][pvId], angle);
				SurfingCheck(GetPlayerVehicleID(playerid));
				UpdatePlayerVehicleParkPosition(ownerid, d, x, y, z, angle, health);
				PutPlayerInVehicle(playerid, GetPlayerVehicleID(playerid), 0);
			 	SetPlayerArmedWeapon(playerid, 0);

				new string[29 + (MAX_PLAYER_NAME * 2)];
				format(string, sizeof(string), "* %s has parked %s's vehicle.", GetPlayerNameEx(playerid), GetPlayerNameEx(ownerid));
				ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				return 1;
			}
		}
	}
	for(new d = 0 ; d < MAX_PLAYERVEHICLES; d++)
	{
		if(IsPlayerInVehicle(playerid, PlayerVehicleInfo[playerid][d][pvId]))
		{
			new Float:x, Float:y, Float:z, Float:angle, Float:health;
			GetVehicleHealth(PlayerVehicleInfo[playerid][d][pvId], health);
            if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessageEx(playerid, COLOR_GREY, "You must be in the driver seat.");
			if(health < 800) return SendClientMessageEx(playerid, COLOR_GREY, " Your vehicle is too damaged to park it.");
			if(PlayerInfo[playerid][pLockCar] == GetPlayerVehicleID(playerid)) PlayerInfo[playerid][pLockCar] = INVALID_VEHICLE_ID;
			GetVehiclePos(PlayerVehicleInfo[playerid][d][pvId], x, y, z);
			GetVehicleZAngle(PlayerVehicleInfo[playerid][d][pvId], angle);
			SurfingCheck(GetPlayerVehicleID(playerid));
			UpdatePlayerVehicleParkPosition(playerid, d, x, y, z, angle, health);
			PutPlayerInVehicle(playerid, PlayerVehicleInfo[playerid][d][pvId], 0);
			SetPlayerArmedWeapon(playerid, 0);

			new string[30 + (MAX_PLAYER_NAME * 2)];
			format(string, sizeof(string), "* %s has parked their vehicle.", GetPlayerNameEx(playerid));
			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
			return 1;
		}
	}
	SendClientMessageEx(playerid, COLOR_GREY, "You need to be inside a vehicle that you own.");
	return 1;
}
Code:
CMD:impound(playerid, params[]) {
	switch(PlayerInfo[playerid][pMember]) {
		case 1, 2, 3, 7, 11: {
			if(!IsAtImpoundingPoint(playerid))
			{
				SendClientMessageEx(playerid, COLOR_GREY, "You are not near the impound point, you can't impound!");
				return 1;
			}
			if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)))
			{

				new
					iVehType,
					iVehIndex,
					iTargetOwner,
					iVehTowed = GetVehicleTrailer(GetPlayerVehicleID(playerid));

				if(!GetVehicleModel(iVehTowed)) {
					return SendClientMessageEx(playerid, COLOR_GREY, "The vehicle in tow has been desynced and therefore cannot be impounded.");
				}
				foreach(Player, i) {
					iVehIndex = GetPlayerVehicle(i, iVehTowed);
					if(iVehIndex != -1) {
						iVehType = 1;
						iTargetOwner = i;
						break;
					}
				}
				if(!iVehType) {
					for(new i; i < MAX_FAMILY; ++i) {
						iVehIndex = GetGangVehicle(i, iVehTowed);
						if(iVehIndex != -1) {
							iVehType = 2;
							iTargetOwner = i;
							break;
						}
					}
				}
				switch(iVehType) {
					case 0, 2: {
						SendClientMessageEx(playerid, COLOR_GRAD1, "The impound administration could not find any registration on the vehicle and has returned it.");
						DetachTrailerFromVehicle(GetPlayerVehicleID(playerid));
						SetVehiclePos(iVehTowed, 0, 0, 0); // Attempted desync fix
						SetVehicleToRespawn(iVehTowed);
					}
					case 1: {

						PlayerVehicleInfo[iTargetOwner][iVehIndex][pvImpounded] = 1;
						PlayerVehicleInfo[iTargetOwner][iVehIndex][pvId] = INVALID_PLAYER_VEHICLE_ID;
						DetachTrailerFromVehicle(GetPlayerVehicleID(playerid));
						SetVehiclePos(iVehTowed, 0, 0, 0); // Attempted desync fix
						DestroyVehicle(iVehTowed);

						--PlayerCars;

						new
							szMessage[96];

						format(szMessage, sizeof(szMessage),"* You have impounded %s's %s.",GetPlayerNameEx(iTargetOwner), VehicleName[PlayerVehicleInfo[iTargetOwner][iVehIndex][pvModelId] - 400]);
						SendClientMessageEx(playerid, COLOR_LIGHTBLUE, szMessage);

						format(szMessage, sizeof(szMessage), "Your %s has been impounded. You may release it at the DMV in Dillimore.", VehicleName[PlayerVehicleInfo[iTargetOwner][iVehIndex][pvModelId] - 400]);
						SendClientMessageEx(iTargetOwner, COLOR_LIGHTBLUE, szMessage);

						format(szMessage, sizeof(szMessage), "HQ: %s has impounded %s's %s ($%i unpaid tickets).", GetPlayerNameEx(playerid), GetPlayerNameEx(iTargetOwner), VehicleName[PlayerVehicleInfo[iTargetOwner][iVehIndex][pvModelId] - 400], PlayerVehicleInfo[iTargetOwner][iVehIndex][pvTicket]);
						SendRadioMessage(PlayerInfo[playerid][pMember], RADIO, szMessage);
					}
					/*case 2: {

						new
							szMessage[29 + MAX_PLAYER_NAME];

						format(szMessage, sizeof(szMessage),"* You have impounded %s's %s.",FamilyInfo[iTargetOwner][FamilyName], GetVehicleName(iVehTowed));
						SendClientMessageEx(playerid, COLOR_LIGHTBLUE, szMessage);

						format(szMessage, sizeof(szMessage), "Your %s has been impounded. You may release it at the BH in Dillimore.", GetVehicleName(iVehTowed));
						SendNewFamilyMessage(iTargetOwner, COLOR_LIGHTBLUE, szMessage);

						FamilyVehicleInfo[iTargetOwner][iVehIndex][fvImpounded] = 1;
						FamilyVehicleInfo[iTargetOwner][iVehIndex][fvId] = INVALID_VEHICLE_ID;
						DestroyVehicle(iVehTowed);
					}*/
				}
				arr_Towing[playerid] = INVALID_VEHICLE_ID;
			}
		}
		default: SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use this command.");
	}
	return 1;
}
Reply
#4

First, you bumped 3 times in one day.

Second, what is the problem with your commands?
Reply
#5

Theres nothing wrong but I want a /apark and /aimpound for admins.... Which takes a bit of changing.
Reply
#6

Try this

Code:
CMD:aimpound(playerid, params[]) {
	if(PlayerInfo[playerid][pAdmin] >= 3) // from admin level 3
			if(!IsAtImpoundingPoint(playerid))
			{
				SendClientMessageEx(playerid, COLOR_GREY, "You are not near the impound point, you can't impound!");
				return 1;
			}
			if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)))
			{

				new
					iVehType,
					iVehIndex,
					iTargetOwner,
					iVehTowed = GetVehicleTrailer(GetPlayerVehicleID(playerid));

				if(!GetVehicleModel(iVehTowed)) {
					return SendClientMessageEx(playerid, COLOR_GREY, "The vehicle in tow has been desynced and therefore cannot be impounded.");
				}
				foreach(Player, i) {
					iVehIndex = GetPlayerVehicle(i, iVehTowed);
					if(iVehIndex != -1) {
						iVehType = 1;
						iTargetOwner = i;
						break;
					}
				}
				if(!iVehType) {
					for(new i; i < MAX_FAMILY; ++i) {
						iVehIndex = GetGangVehicle(i, iVehTowed);
						if(iVehIndex != -1) {
							iVehType = 2;
							iTargetOwner = i;
							break;
						}
					}
				}
				switch(iVehType) {
					case 0, 2: {
						SendClientMessageEx(playerid, COLOR_GRAD1, "The impound administration could not find any registration on the vehicle and has returned it.");
						DetachTrailerFromVehicle(GetPlayerVehicleID(playerid));
						SetVehiclePos(iVehTowed, 0, 0, 0); // Attempted desync fix
						SetVehicleToRespawn(iVehTowed);
					}
					case 1: {

						PlayerVehicleInfo[iTargetOwner][iVehIndex][pvImpounded] = 1;
						PlayerVehicleInfo[iTargetOwner][iVehIndex][pvId] = INVALID_PLAYER_VEHICLE_ID;
						DetachTrailerFromVehicle(GetPlayerVehicleID(playerid));
						SetVehiclePos(iVehTowed, 0, 0, 0); // Attempted desync fix
						DestroyVehicle(iVehTowed);

						--PlayerCars;

						new
							szMessage[96];

						format(szMessage, sizeof(szMessage),"* You have impounded %s's %s.",GetPlayerNameEx(iTargetOwner), VehicleName[PlayerVehicleInfo[iTargetOwner][iVehIndex][pvModelId] - 400]);
						SendClientMessageEx(playerid, COLOR_LIGHTBLUE, szMessage);

						format(szMessage, sizeof(szMessage), "Your %s has been impounded. You may release it at the DMV in Dillimore.", VehicleName[PlayerVehicleInfo[iTargetOwner][iVehIndex][pvModelId] - 400]);
						SendClientMessageEx(iTargetOwner, COLOR_LIGHTBLUE, szMessage);

						format(szMessage, sizeof(szMessage), "HQ: %s has impounded %s's %s ($%i unpaid tickets).", GetPlayerNameEx(playerid), GetPlayerNameEx(iTargetOwner), VehicleName[PlayerVehicleInfo[iTargetOwner][iVehIndex][pvModelId] - 400], PlayerVehicleInfo[iTargetOwner][iVehIndex][pvTicket]);
						SendRadioMessage(PlayerInfo[playerid][pMember], RADIO, szMessage);
					}
					/*case 2: {

						new
							szMessage[29 + MAX_PLAYER_NAME];

						format(szMessage, sizeof(szMessage),"* You have impounded %s's %s.",FamilyInfo[iTargetOwner][FamilyName], GetVehicleName(iVehTowed));
						SendClientMessageEx(playerid, COLOR_LIGHTBLUE, szMessage);

						format(szMessage, sizeof(szMessage), "Your %s has been impounded. You may release it at the BH in Dillimore.", GetVehicleName(iVehTowed));
						SendNewFamilyMessage(iTargetOwner, COLOR_LIGHTBLUE, szMessage);

						FamilyVehicleInfo[iTargetOwner][iVehIndex][fvImpounded] = 1;
						FamilyVehicleInfo[iTargetOwner][iVehIndex][fvId] = INVALID_VEHICLE_ID;
						DestroyVehicle(iVehTowed);
					}*/
				}
				arr_Towing[playerid] = INVALID_VEHICLE_ID;
			}
		}
		default: SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use this command.");
	}
	return 1;
}
Reply
#7

lider1241, use [pawn][/pawn] tags for better indentation.
Reply
#8

No, I mean for the impound:

1. You must be admin
2. You can be anywhere, ofc you don't have to be at the impound point.

And I still need the /apark also.

NGG has these two commands, and its really useful/really professional, please help. I will rep you, and will be your friend.
Reply
#9

RedJohn - when first reply there is only Quote, then after posting the reply i edit it to Pawn code...
Reply
#10

DO NOT DOUBLE POST! READ RULES!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)