Thursday, November 18, 2010

SAMP Scripting Tutorial: Movable Objects I - Create Objects [MTA MapEditor]

Here is the code

// Variable Declaration
new bar;

// OnGameModeInit
//Fences
CreateObject(992, 1544.6911621094, -1622.0278320313, 14.102454185486, 0, 0, 90);
CreateObject(992, 1544.6866455078, -1619.5272216797, 14.110140800476, 0, 0, 90);
CreateObject(992, 1545.2962646484, -1634.3321533203, 14.109854698181, 0, 0, 90);
CreateObject(992, 1545.2634277344, -1637.7028808594, 14.53718662262, 0, 0, 90);

//Barrier
bar = CreateObject(968, 1544.6640625, -1623.9732666016, 12.989388465881, 352, 270, 90);[/cpp]
[cpp title="InitPos()"]
public InitPos()
{
 SetObjectPos(bar,1544.6640625, -1623.9732666016, 12.989388465881);
 SetObjectRot(bar,352,270,90);
}

// OnPlayerCommandText
if(strcmp(cmdtext,"/openbarrier",true)==0)
{
 SetObjectPos(bar,1544.6640625, -1623.9732666016, 12.989388465881);
 SetObjectRot(bar,352, 0, 90);
 SetTimer("InitPos",5000,false);
 return 1;
}

1 comment: