[help] Door system
#1

Hello so i need help with this code i tried to make it that a player can buy or own the door but it says Owner: Goverment or Owner: LAPD i want it to have the players name and i also trying to make it lockable like /lockdoor and its asined to a faction i think i don't want that i just need it to be a player owned door


Код:
command(ddcreate, playerid, params[])
{
	new Usage[255], string[255];

    if(Player[playerid][AdminLevel] >= 3)
    {
        if(sscanf(params, "z", Usage))
	    {
			SendClientMessage(playerid, WHITE, "USAGE: /ddcreate [usage]");
			SendClientMessage(playerid, GREY, "Usages: Exterior, Interior, Complete.");
		}
		else
		{
			new dID = SpawnedDoors+1;

		    if(strcmp(Usage, "exterior", true) == 0)
            {

				GetPlayerPos(playerid, Doors[dID][dExteriorX], Doors[dID][dExteriorY], Doors[dID][dExteriorZ]);
                GetPlayerFacingAngle(playerid, Doors[dID][dExteriorA]);
                Doors[dID][dExteriorVW] = GetPlayerVirtualWorld(playerid);
                Doors[dID][dExteriorInt] = GetPlayerInterior(playerid);
                format(string, sizeof(string), "You have successfully set the exterior of Doors %d.", dID);
           	    SendClientMessage(playerid, WHITE, string);
           	    format(string, sizeof(string), "X: %f, Y: %f, Z: %f, A: %f, VW: %d, Int: %d", Doors[dID][dExteriorX], Doors[dID][dExteriorY], Doors[dID][dExteriorZ], Doors[dID][dExteriorA], Doors[dID][dExteriorVW], Doors[dID][dExteriorInt]);
           	    SendClientMessage(playerid, GREY, string);
           	    return 1;
       		}
       		if(strcmp(Usage, "interior", true) == 0)
            {
				GetPlayerPos(playerid, Doors[dID][dInteriorX], Doors[dID][dInteriorY], Doors[dID][dInteriorZ]);
                GetPlayerFacingAngle(playerid, Doors[dID][dInteriorA]);
                Doors[dID][dInteriorVW] = GetPlayerVirtualWorld(playerid);
                Doors[dID][dInteriorInt] = GetPlayerInterior(playerid);
                format(string, sizeof(string), "You have successfully set the interior of Doors %d.", dID);
           	    SendClientMessage(playerid, WHITE, string);
           	    format(string, sizeof(string), "X: %f, Y: %f, Z: %f, A: %f, VW: %d, Int: %d", Doors[dID][dInteriorX], Doors[dID][dInteriorY], Doors[dID][dInteriorZ], Doors[dID][dInteriorA], Doors[dID][dInteriorVW], Doors[dID][dInteriorInt]);
           	    SendClientMessage(playerid, GREY, string);
           	    return 1;
       		}
       		if(strcmp(Usage, "complete", true) == 0)
            {
				if(Doors[dID][dExteriorX] > 0 && Doors[dID][dInteriorX] > 0)
				{
					if(dID >= MAX_DOORS)
                	{
                    	SendClientMessage(playerid, GREY, "  Error: Too many Doors are currently spawend.");
                	}
                	else
                	{
                        format(string, sizeof(string), "Doors/%d.ini", dID);

	                	if(!fexist(string))
	                	{
                            dini_Create(string);
                            Doors[dID][dType] = dini_IntSet(string, "dType", 0);
                            Doors[dID][dOwner] = dini_Set(string, "dOwner", "Nobody");
                            Doors[dID][dFaction] = dini_IntSet(string, "dFaction", 0);
                            Doors[dID][dLock] = dini_IntSet(string, "dLock", 0);
                            Doors[dID][dPickupModel] = dini_IntSet(string, "dPickupModel", 1318);

							dini_FloatSet(string, "dExteriorX", Doors[dID][dExteriorX]);
							dini_FloatSet(string, "dExteriorY", Doors[dID][dExteriorY]);
							dini_FloatSet(string, "dExteriorZ", Doors[dID][dExteriorZ]);
							dini_FloatSet(string, "dExteriorA", Doors[dID][dExteriorA]);
							dini_IntSet(string, "dExteriorVW", Doors[dID][dExteriorVW]);
							dini_IntSet(string, "dExteriorInt", Doors[dID][dExteriorInt]);

							dini_FloatSet(string, "dInteriorX", Doors[dID][dInteriorX]);
							dini_FloatSet(string, "dInteriorY", Doors[dID][dInteriorY]);
							dini_FloatSet(string, "dInteriorZ", Doors[dID][dInteriorZ]);
							dini_FloatSet(string, "dInteriorA", Doors[dID][dInteriorA]);
							dini_IntSet(string, "dInteriorVW", Doors[dID][dInteriorVW]);
							dini_IntSet(string, "dInteriorInt", Doors[dID][dInteriorInt]);

							SpawnedDoors++;

							format(string, sizeof(string), "You have successfully created Doors %d.", dID);
                            SendClientMessage(playerid, WHITE, string);

                            SetPlayerPos(playerid, Doors[dID][dExteriorX],  Doors[dID][dExteriorY],  Doors[dID][dExteriorZ]);
                            SetPlayerVirtualWorld(playerid, Doors[dID][dExteriorVW]);
                            SetPlayerInterior(playerid, Doors[dID][dExteriorInt]);
                            SetPlayerFacingAngle(playerid, Doors[dID][dExteriorA]);
				            SetCameraBehindPlayer(playerid);

                            SaveDoor(dID);
                            return 1;
						}
						else
	        	        {
	    	                SendClientMessage(playerid, GREY, "  Error: File already exists, script error.");
		                }
					}
				}
				else
				{
					SendClientMessage(playerid, GREY, "  You need to set the Doors's (ex/in)terior before completing!");
					return 1;
				}
       		}
		}
    }
    return 1;
}

command(ddname, playerid, params[])
{
	new Usage[255], id;
    if(Player[playerid][AdminLevel] >= 3)
    {
        if(sscanf(params, "dz", id, Usage))
	    {
			SendClientMessage(playerid, WHITE, "USAGE: /ddname [id] [name]");
		}
		else
		{
            Doors[id][dName] = Usage;
            SaveDoor(id);
		}
	}
	return 1;
}

command(ddedit, playerid, params[])
{
	new id, Usage[255], Value, string[255];

    if(Player[playerid][AdminLevel] >= 3)
    {
        if(sscanf(params, "dzD", id, Usage, Value))
	    {
			SendClientMessage(playerid, WHITE, "USAGE: /ddedit [id] [usage] [* value]");
			SendClientMessage(playerid, GREY, "Usages: Exterior, Interior, * Type, * Faction");
		}
		else
		{
		    if(strcmp(Usage, "exterior", true) == 0)
            {

				GetPlayerPos(playerid, Doors[id][dExteriorX], Doors[id][dExteriorY], Doors[id][dExteriorZ]);
                GetPlayerFacingAngle(playerid, Doors[id][dExteriorA]);
                Doors[id][dExteriorVW] = GetPlayerVirtualWorld(playerid);
                Doors[id][dExteriorInt] = GetPlayerInterior(playerid);
                format(string, sizeof(string), "You have successfully re-set the exterior of Door %d.", id);
           	    SendClientMessage(playerid, WHITE, string);
           	    format(string, sizeof(string), "X: %f, Y: %f, Z: %f, A: %f, VW: %d, Int: %d", Doors[id][dExteriorX], Doors[id][dExteriorY], Doors[id][dExteriorZ], Doors[id][dExteriorA], Doors[id][dExteriorVW], Doors[id][dExteriorInt]);
           	    SendClientMessage(playerid, GREY, string);
           	    SaveDoor(id);
           	    return 1;
       		}
       		if(strcmp(Usage, "interior", true) == 0)
            {
				GetPlayerPos(playerid, Doors[id][dInteriorX], Doors[id][dInteriorY], Doors[id][dInteriorZ]);
                GetPlayerFacingAngle(playerid, Doors[id][dInteriorA]);
                Doors[id][dInteriorVW] = GetPlayerVirtualWorld(playerid);
                Doors[id][dInteriorInt] = GetPlayerInterior(playerid);
                format(string, sizeof(string), "You have successfully re-set the interior of Door %d.", id);
           	    SendClientMessage(playerid, WHITE, string);
           	    format(string, sizeof(string), "X: %f, Y: %f, Z: %f, A: %f, VW: %d, Int: %d", Doors[id][dInteriorX], Doors[id][dInteriorY], Doors[id][dInteriorZ], Doors[id][dInteriorA], Doors[id][dInteriorVW], Doors[id][dInteriorInt]);
           	    SendClientMessage(playerid, GREY, string);
           	    SaveDoor(id);
           	    return 1;
       		}
       		if(strcmp(Usage, "type", true) == 0)
            {
				Doors[id][dType] = Value;
                format(string, sizeof(string), "You have successfully re-set the type of Door %d to %d.", id, Value);
           	    SendClientMessage(playerid, WHITE, string);
           	    SaveDoor(id);
           	    return 1;
       		}
       		if(strcmp(Usage, "faction", true) == 0)
            {
				if(Doors[id][dType] == 1)
				{
				    Doors[id][dFaction] = Value;
                    format(string, sizeof(string), "You have successfully re-set the faction of Door %d to %d.", id, Value);
           	        SendClientMessage(playerid, WHITE, string);
           	        SaveDoor(id);
				}
				else
				{
					SendClientMessage(playerid, GREY, "This door does not belong to a faction. /ddedit [id] type 1");
				}
           	    return 1;
       		}
       		if(strcmp(Usage, "model", true) == 0)
            {
				Doors[id][dPickupModel] = Value;
                format(string, sizeof(string), "You have successfully re-set the model of Door %d to %d.", id, Value);
           	    SendClientMessage(playerid, WHITE, string);
           	    SaveDoor(id);
           	    return 1;
       		}
		}
    }
    return 1;
}
Reply


Messages In This Thread
[help] Door system - by BigGreen - 02.11.2015, 02:23

Forum Jump:


Users browsing this thread: 1 Guest(s)