Page 1 of 1

SetObjectRot cu Exemplu

Posted: Mon Oct 24, 2011 5:37 am
by RoberTo
M-am hotarat sa fac acest tutorial din doua motive :
1. M-au intrebat multi "cum sa fac o comanda cu SetObjectRot".
2. Vreu sa va ajut.

Acuma ca stiti motivele se ne apucam de lucru.

O sa va zic pasii care trebuie fie facuti pana la comanda :
Pasul 1. Sa intram in MTA ( cel care il aveti voi ) creem un obiect (ex: gate , bariera , etc.) cand am terminat de facut dam save.
Pasul 2. Intram pe un site unde sa convertam pentru PAWNO.
Pasul 3. Am facut convertorul....o sa ne apara ceva de genu CreateObject([ID-ul obiectului],[Coordonatele x,y,z], [RotX, RotY, RotZ]); cea ce ne intereseaza sunt rotatiile X,Y,Z
Pasul 4. Sa denumim obiectul : new objectPasul
Pasul 5. Trecem crearea obiectului la public OnGameModeInit() , va fi asa object = CreateObject([ID-ul obiectului],[Coordonatele x,y,z], [RotX, RotY, RotZ ].( exemplu : CreateObject([ID-ul obiectului],[Coordonatele x,y,z], 0.0000, 0.0000, 60.5471);

Acuma am sa va arat cum sa faceti comanda:
la public OnPlayerCommandText(playerid, cmdtext[]) scrie comanda :

Code: Select all

    if(!strcmp(cmdtext, "/comanda", true))
    {
    if(PlayerInfo[playerid][pLeader] == [ID-ul factiunii] || PlayerInfo[playerid][pMember] == [ID-ul factiunii]// Daca vrem sa facem o comanda numai pentru o anumita factiune
    {
[b]    SetObjectRot([obiectul numit],rotX,rotY,rotZ);[/b]
    }
    else return SendClientMessage(playerid, COLOR_YELLOW,"Tu nu esti in [ce factiune doriti].");
    return 1;
}
 
Daca vreti sa faceti ca se inchida automat faceti urmatorii pasi :
1-La forward , scrieti forward GateClose();[sau cum vreti voi]
2-Jos de tot scrieti
public GateClose()
{
return 1;
}
Un exemplu
public GateClose()
{
SetObjectRot([obiectul numit], rotX,rotY,rotZ); sau
MoveObject([obiectul numit],x,y,z,[timpul de miscare]);
return 1;
}

PS : Nu iutati sa adugati la comanda SetTimer