PDA

View Full Version : Elevator menu unfinised


Qink
09/06/2013, 10:31 PM
Hello, so I mapped a mansion that included three floors, so I made an elevator for it, it contains only one object, going between the three floors, but after I finished the script and sent it to the owner, he said it is kinda unfinished, but I don't know how to fix it, can somebody please help me? by the way, I want the menu to be enabled only if someone is 10 meters near it.
new Menu:ElevatorMenu;
ElevatorMenu = CreateMenu("ElevatorMenu", 2, 200.0, 100.0, 150.0, 150.0);
CreateMenu(Khal's Elevator, 1, 0, 0, 5, 0);

AddMenuItem(Elevatormenu, 1, "From 1 to 2");
AddMenuItem(Elevatormenu, 1, "From 1 to 3");
AddMenuItem(Elevatormenu, 1, "From 2 to 1");
AddMenuItem(Elevatormenu, 1, "From 2 to 3");
AddMenuItem(Elevatormenu, 1, "From 3 to 1");
AddMenuItem(Elevatormenu, 1, "From 3 to 2");

new Menu:CurrentMenu = GetPlayerMenu(playerid);

public ;if(CurrentMenu == ElevatorMenu)
{
switch(row)
{
case 0: //From 1 to 2
{
MoveObject(CreateDynamicObject(19366,2912.4296875,-1080.5000000,10.8,0.0000000,90.0000000,90.0000000) ; //object(blokmod2_sfw03) (20), 2912.4296875, -1080.5000000, 14.10000038147, 3, 0, 90, 90)
}
case 1: //From 1 to 3
{
MoveObject(CreateDynamicObject(19366,2912.4296875,-1080.5000000,10.8,0.0000000,90.0000000,90.0000000) ; //object(blokmod2_sfw03) (20), 2912.4296875, -1080.5000000, 18.10000038147, 3, 0, 90, 90)
}
case 2: //From 2 to 1
{
MoveObject(CreateDynamicObject(19366,2912.4296875,-1080.5000000,14.10000038147,0.0000000,90.0000000,9 0.0000000); //object(blokmod2_sfw03) (20), 2912.4296875, -1080.5000000, 10.8, 3, 0, 90, 90)
}
case 3: //From 2 to 3
{
MoveObject(CreateDynamicObject(19366,2912.4296875,-1080.5000000,14.10000038147,0.0000000,90.0000000,9 0.0000000); //object(blokmod2_sfw03) (20), 2912.4296875, -1080.5000000, 18.10000038147, 3, 0, 90, 90)
}
case 4: //From 3 to 1
{
MoveObject(CreateDynamicObject(19366,2912.4296875,-1080.5000000,18.10000038147,0.0000000,90.0000000,9 0.0000000); //object(blokmod2_sfw03) (20), 2912.4296875, -1080.5000000, 10.8, 3, 0, 90, 90)
}
case 5: //From 3 to 2
{
MoveObject(CreateDynamicObject(19366,2912.4296875,-1080.5000000,18.10000038147,0.0000000,90.0000000,9 0.0000000); //object(blokmod2_sfw03) (20), 2912.4296875, -1080.5000000, 14.10000038147, 3, 0, 90, 90)
}
}
}

if(!strcmp("/Khalelevator",cmdtext))
{
if(IsPlayerInRangeOfPoint(playerid, 10.0, 4296875,-1080.5000000,14.10000038147))
{
ShowMenuForPlayer(ElevatorMenu,playerid);
}
return 1;
}
Waiting for your reply! :D:D

SomebodyAndMe
09/06/2013, 10:48 PM
SAMP has it's own elevator script in the filterscripts.
You might want to check that out.

http://pastebin.com/CQ83VfsT

Qink
09/06/2013, 10:50 PM
I know, it's just 1 object, I'm not talking about the elevator itself, it's just a couple of (MoveObject)s, that are put in a menu, but I want to know how to put it in the right final form

[MG]Dimi
09/06/2013, 10:52 PM
But what is final form? You need to explain to us.

Qink
09/06/2013, 11:11 PM
He told me there is some "public"s missing, some { } etc, like final touches and he said I can't just put ;if(CurrentMenu == ElevatorMenu) into the gamemod, and he said something about onplayercommandtext

Tamer
09/06/2013, 11:17 PM
Well obviously your command must go under the OnPlayerCommandText callback.
http://wiki.sa-mp.com/wiki/OnPlayerCommandText

Qink
09/06/2013, 11:24 PM
Should it look like this?
new Menu:ElevatorMenu;
ElevatorMenu = CreateMenu("ElevatorMenu", 2, 200.0, 100.0, 150.0, 150.0);
CreateMenu(Khal's Elevator, 1, 0, 0, 5, 0);

AddMenuItem(Elevatormenu, 1, "From 1 to 2");
AddMenuItem(Elevatormenu, 1, "From 1 to 3");
AddMenuItem(Elevatormenu, 1, "From 2 to 1");
AddMenuItem(Elevatormenu, 1, "From 2 to 3");
AddMenuItem(Elevatormenu, 1, "From 3 to 1");
AddMenuItem(Elevatormenu, 1, "From 3 to 2");

new Menu:CurrentMenu = GetPlayerMenu(playerid);

public ;if(CurrentMenu == ElevatorMenu)
{
switch(row)
{
case 0: //From 1 to 2
{
MoveObject(CreateDynamicObject(19366,2912.4296875,-1080.5000000,10.8,0.0000000,90.0000000,90.0000000) ; //object(blokmod2_sfw03) (20), 2912.4296875, -1080.5000000, 14.10000038147, 3, 0, 90, 90)
}
case 1: //From 1 to 3
{
MoveObject(CreateDynamicObject(19366,2912.4296875,-1080.5000000,10.8,0.0000000,90.0000000,90.0000000) ; //object(blokmod2_sfw03) (20), 2912.4296875, -1080.5000000, 18.10000038147, 3, 0, 90, 90)
}
case 2: //From 2 to 1
{
MoveObject(CreateDynamicObject(19366,2912.4296875,-1080.5000000,14.10000038147,0.0000000,90.0000000,9 0.0000000); //object(blokmod2_sfw03) (20), 2912.4296875, -1080.5000000, 10.8, 3, 0, 90, 90)
}
case 3: //From 2 to 3
{
MoveObject(CreateDynamicObject(19366,2912.4296875,-1080.5000000,14.10000038147,0.0000000,90.0000000,9 0.0000000); //object(blokmod2_sfw03) (20), 2912.4296875, -1080.5000000, 18.10000038147, 3, 0, 90, 90)
}
case 4: //From 3 to 1
{
MoveObject(CreateDynamicObject(19366,2912.4296875,-1080.5000000,18.10000038147,0.0000000,90.0000000,9 0.0000000); //object(blokmod2_sfw03) (20), 2912.4296875, -1080.5000000, 10.8, 3, 0, 90, 90)
}
case 5: //From 3 to 2
{
MoveObject(CreateDynamicObject(19366,2912.4296875,-1080.5000000,18.10000038147,0.0000000,90.0000000,9 0.0000000); //object(blokmod2_sfw03) (20), 2912.4296875, -1080.5000000, 14.10000038147, 3, 0, 90, 90)
}
}
}

public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/KhalElevator", true))
{

if(IsPlayerInRangeOfPoint(playerid, 10.0, 4296875,-1080.5000000,14.10000038147))
{
ShowMenuForPlayer(ElevatorMenu,playerid);
}
return 1;
}

Qink
09/06/2013, 11:35 PM
Any thoughts?

SomebodyAndMe
10/06/2013, 01:10 AM
Why dont you test it yourself on a local server lol?

Qink
10/06/2013, 01:15 AM
I don't know how to make test server.