Object
#1

How to make, that objects are shown only at Requesting Class?
Reply
#2

OnPlayerRequestClass (player objects appear - one time only because the callback is called everytime you change class), OnPlayerSpawn (they disappear)... Simple as 123
Reply
#3

so, what i need do, that i can see object onplayerrequestclass?
Reply
#4

You create the objects under the OnPlayerRequestClass callback. Something like:

pawn Код:
//OnPlayerRequestClass
if( !IsValidObject( Some_Stupid_Object ) )
{
    Some_Stupid_Object = CreateObject( ... );
}
Then:
pawn Код:
//OnPlayerRequestSpawn
if( IsValidObject( Some_Stupid_Object ) )
{
    DestroyObject( Some_Stupid_Object );
    Some_Stupid_Object = -1;
}
Reply
#5

or you can do
pawn Код:
new object;

public OnPlayerRequestClass(playerid, classid)
{
    object = CreateObject(ID,X,Y,Z,Xr,Yr,Zr,DrawDistance); // THIS WILL CREATE OBJECT WHEN PLAYER IS ON REQUEST CLASS SELECTION
    return 1;
}
public OnPlayerSpawn(playerid)
{
    DestroyObject(object); // THIS WILL DESTROY OBJECT WHEN PLAYER SPAWN

    return 1;
}
TRY IT.
Reply
#6

no it isnt work....

pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    oc[0] = CreateDynamicObject(18728, 1893.453125, 1630.473510, 68.144126, 0.000000, 0.000000, 0.000000, -1, -1, -1, 275.0);
    oc[1] = CreateDynamicObject(18728, 1893.453125, 1626.343383, 68.480941, 0.000000, 0.000000, 0.000000, -1, -1, -1, 275.0);
    oc[2] = CreateDynamicObject(18693, 1898.718750, 1626.356689, 73.194992, 0.000000, 0.000000, 0.000000, -1, -1, -1, 275.0);
    oc[3] = CreateDynamicObject(18693, 1898.718750, 1626.639648, 73.202049, 0.000000, 0.000000, 0.000000, -1, -1, -1, 275.0);
    oc[4] = CreateDynamicObject(18693, 1898.718750, 1626.913574, 73.172325, 0.000000, 0.000000, 0.000000, -1, -1, -1, 275.0);
    oc[5] = CreateDynamicObject(18693, 1898.718750, 1627.201049, 73.177566, 0.000000, 0.000000, 0.000000, -1, -1, -1, 275.0);
    oc[6] = CreateDynamicObject(18693, 1898.718750, 1627.506713, 73.181541, 0.000000, 0.000000, 0.000000, -1, -1, -1, 275.0);
    oc[7] = CreateDynamicObject(18693, 1898.718750, 1627.817382, 73.197715, 0.000000, 0.000000, 0.000000, -1, -1, -1, 275.0);
    oc[8] = CreateDynamicObject(18693, 1898.718750, 1628.142700, 73.171890, 0.000000, 0.000000, 0.000000, -1, -1, -1, 275.0);
    oc[9] = CreateDynamicObject(18693, 1898.718750, 1628.468994, 73.197288, 0.000000, 0.000000, 0.000000, -1, -1, -1, 275.0);
    oc[10] = CreateDynamicObject(18693, 1898.718750, 1628.809570, 73.187202, 0.000000, 0.000000, 0.000000, -1, -1, -1, 275.0);
    oc[11] = CreateDynamicObject(18693, 1898.718750, 1629.106933, 73.210678, 0.000000, 0.000000, 0.000000, -1, -1, -1, 275.0);
    oc[12] = CreateDynamicObject(18693, 1898.718750, 1629.432617, 73.213485, 0.000000, 0.000000, 0.000000, -1, -1, -1, 275.0);
    oc[13] = CreateDynamicObject(18693, 1898.718750, 1629.794189, 73.189857, 0.000000, 0.000000, 0.000000, -1, -1, -1, 275.0);
    oc[14] = CreateDynamicObject(18693, 1898.718750, 1630.600219, 73.170524, 0.000000, 0.000000, 0.000000, -1, -1, -1, 275.0);
    oc[15] = CreateDynamicObject(18693, 1898.718750, 1630.323364, 73.165512, 0.000000, 0.000000, 0.000000, -1, -1, -1, 275.0);
    oc[16] = CreateDynamicObject(18693, 1898.718750, 1630.056152, 73.192611, 0.000000, 0.000000, 0.000000, -1, -1, -1, 275.0);
    SetPlayerPos(playerid, 1896.675048,1628.547119,75.718750);
    SetPlayerCameraPos(playerid, 1899.517700,1628.396362,75.718750);
    SetPlayerCameraLookAt(playerid, 1896.675048,1628.547119,75.718750);
    SetPVarInt(playerid, "Joinned", 1); //setting PVar that player is joinned
    return 1;
}
and nothing, i change skin, nothing it dont have no one object..

http://i53.tinypic.com/11bkh77.png
http://i55.tinypic.com/ipmdrd.png
Reply
#7

CreateDynamicObject doesn't work when you adding it in game , only CreateObject
Reply
#8

nope it dosent show :S

pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    oc[0] = CreateObject(18728, 1893.453125, 1630.473510, 68.144126, 0.000000, 0.000000, 0.000000);
    oc[1] = CreateObject(18728, 1893.453125, 1626.343383, 68.480941, 0.000000, 0.000000, 0.000000);
    oc[2] = CreateObject(18693, 1898.718750, 1626.356689, 73.194992, 0.000000, 0.000000, 0.000000);
    oc[3] = CreateObject(18693, 1898.718750, 1626.639648, 73.202049, 0.000000, 0.000000, 0.000000);
    oc[4] = CreateObject(18693, 1898.718750, 1626.913574, 73.172325, 0.000000, 0.000000, 0.000000);
    oc[5] = CreateObject(18693, 1898.718750, 1627.201049, 73.177566, 0.000000, 0.000000, 0.000000);
    oc[6] = CreateObject(18693, 1898.718750, 1627.506713, 73.181541, 0.000000, 0.000000, 0.000000);
    oc[7] = CreateObject(18693, 1898.718750, 1627.817382, 73.197715, 0.000000, 0.000000, 0.000000);
    oc[8] = CreateObject(18693, 1898.718750, 1628.142700, 73.171890, 0.000000, 0.000000, 0.000000);
    oc[9] = CreateObject(18693, 1898.718750, 1628.468994, 73.197288, 0.000000, 0.000000, 0.000000);
    oc[10] = CreateObject(18693, 1898.718750, 1628.809570, 73.187202, 0.000000, 0.000000, 0.000000);
    oc[11] = CreateObject(18693, 1898.718750, 1629.106933, 73.210678, 0.000000, 0.000000, 0.000000);
    oc[12] = CreateObject(18693, 1898.718750, 1629.432617, 73.213485, 0.000000, 0.000000, 0.000000);
    oc[13] = CreateObject(18693, 1898.718750, 1629.794189, 73.189857, 0.000000, 0.000000, 0.000000);
    oc[14] = CreateObject(18693, 1898.718750, 1630.600219, 73.170524, 0.000000, 0.000000, 0.000000);
    oc[15] = CreateObject(18693, 1898.718750, 1630.323364, 73.165512, 0.000000, 0.000000, 0.000000);
    oc[16] = CreateObject(18693, 1898.718750, 1630.056152, 73.192611, 0.000000, 0.000000, 0.000000);
    SetPlayerPos(playerid, 1896.675048,1628.547119,75.718750);
    SetPlayerCameraPos(playerid, 1899.517700,1628.396362,75.718750);
    SetPlayerCameraLookAt(playerid, 1896.675048,1628.547119,75.718750);
    SetPVarInt(playerid, "Joinned", 1); //setting PVar that player is joinned
    return 1;
}
Reply
#9

bump, someone help?
Reply
#10

Quote:
Originally Posted by Nathy.SA-MP
Посмотреть сообщение
OnPlayerSpawn:

pawn Код:
for(new i; i < 16; ++i) DestroyObject(oc[i]);
but i want to see object onplayerrequestclass :S
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)