PDA

View Full Version : Object


Speed
27/08/2011, 08:02 PM
How to make, that objects are shown only at Requesting Class?

iMonk3y
27/08/2011, 08:13 PM
OnPlayerRequestClass (player objects appear - one time only because the callback is called everytime you change class), OnPlayerSpawn (they disappear)... Simple as 123

Speed
27/08/2011, 08:43 PM
so, what i need do, that i can see object onplayerrequestclass?

iMonk3y
27/08/2011, 09:18 PM
You create the objects under the OnPlayerRequestClass callback. Something like:


//OnPlayerRequestClass
if( !IsValidObject( Some_Stupid_Object ) )
{
Some_Stupid_Object = CreateObject( ... );
}

Then:

//OnPlayerRequestSpawn
if( IsValidObject( Some_Stupid_Object ) )
{
DestroyObject( Some_Stupid_Object );
Some_Stupid_Object = -1;
}

Amel_PAtomAXx
27/08/2011, 09:23 PM
or you can do

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.

Speed
28/08/2011, 10:13 AM
no it isnt work....


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

Amel_PAtomAXx
28/08/2011, 10:22 AM
CreateDynamicObject doesn't work when you adding it in game :( , only CreateObject

Speed
28/08/2011, 11:07 AM
nope it dosent show :S


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;
}

Speed
30/08/2011, 09:30 PM
bump, someone help?

Speed
31/08/2011, 11:30 AM
OnPlayerSpawn:


for(new i; i < 16; ++i) DestroyObject(oc[i]);


but i want to see object onplayerrequestclass :S

Speed
02/09/2011, 06:32 PM
bump, can someone help me?