SA-MP Forums Archive
How to make smth like that - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to make smth like that (/showthread.php?tid=212659)



How to make smth like that - Darien - 17.01.2011

I dont know how to make stuff like open doors with password.

Eample : i Want to open the doors i press [F] button near doors and in dialog box i should type password, and doors will open. After 5s doors will close.


Re: How to make smth like that - Alex_Valde - 17.01.2011

These are some of the functions and callbacks to start with: OnPlayerKeyStateChange, ShowPlayerDialog, OnDialogResponse, SetTimerEx MoveObject.


Re: How to make smth like that - Darien - 17.01.2011

i dont understand anything, i need script example


Re: How to make smth like that - Darien - 17.01.2011

i have this one

Код:
if IsPlayerInRangeOfPoint(playerid, 1.5,2680.30444336,3969.71020508,7.33100510))
	{
	    MoveObject(boxes, 2683.57153320,3966.04736328,7.33100510, 2.2500000);
	    SetTimer("boxes", 4500, false);
	}

and some errors

C:\Documents and Settings\Minde\Desktop\Server 3c\pawno\include\streamer.inc(435) : warning 202: number of arguments does not match definition
C:\Documents and Settings\Minde\Desktop\Server 3c\pawno\include\streamer.inc(449) : warning 202: number of arguments does not match definition
C:\DOCUME~1\Minde\Desktop\SERVER~1\FILTER~1\miestas.pwn(20) : warning 217: loose indentation
C:\DOCUME~1\Minde\Desktop\SERVER~1\FILTER~1\miestas.pwn(596) : warning 217: loose indentation
C:\DOCUME~1\Minde\Desktop\SERVER~1\FILTER~1\miestas.pwn(24) : warning 204: symbol is assigned a value that is never used: "boxes"
C:\DOCUME~1\Minde\Desktop\SERVER~1\FILTER~1\miestas.pwn(24 -- 598) : error 010: invalid function or declaration
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.



Re: How to make smth like that - alpha500delta - 17.01.2011

Moveobject needs a speed parameter to


Re: How to make smth like that - Not available - 17.01.2011

Okei, I made a quick draft that you could work with. This is not tested and may return errors as I wrote it on a Mac without a compiler =/

pawn Код:
#define doorPw "MyCatIsDumb"
new bool:DoorStatus;

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_SECONDARY_ATTACK && IsPlayerInRangeOfPoint(playerid, 1.5, 2680.30444336, 3969.71020508, 7.33100510))
    {
        ShowPlayerDialog(playerid, 1, 1, "Doors", "Please type in the password to continue:", "Go", "Cancel");
    }
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 1)
    {
        if(!strcmp(inputtext, doorPw, false))
        {
            if(!DoorStatus)
            {
                MoveObject(boxes, 2683.57153320,3966.04736328,7.33100510, 2.2500000, 2.0);
                SetTimer("boxes", 4500, false);
            }
            return 1;
        }
        else return ShowPlayerDialog(playerid, 2, 0, "Error", "That's not the right password!", "Ok", "");
    }
    return 0;
}

forward CloseDoors();
public CloseDoors()
{
    if(DoorStatus)
    {
        MoveObject(boxes, 2683.57153320,3966.04736328,7.33100510, 2.2500000, 2.0); // close the doors here
    }
    return 1;
}



Re: How to make smth like that - Darien - 18.01.2011

mmmm


Re: How to make smth like that - Darien - 22.01.2011

it compiled without errors but gates wont to move


Re: How to make smth like that - Not available - 22.01.2011

Did you remember to change the co-ordinates for the moved object?
pawn Код:
MoveObject(boxes, 2683.57153320,3966.04736328,7.33100510, 2.2500000, 2.0); // This is the default you gave us, should probably be changed.



Re: How to make smth like that - Darien - 23.01.2011

Quote:
Originally Posted by Not available
Посмотреть сообщение
Did you remember to change the co-ordinates for the moved object?
pawn Код:
MoveObject(boxes, 2683.57153320,3966.04736328,7.33100510, 2.2500000, 2.0); // This is the default you gave us, should probably be changed.
Yes, and i deleted one space between
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{


then gates will open, but not close