27.08.2011, 20:02
How to make, that objects are shown only at Requesting Class?
//OnPlayerRequestClass
if( !IsValidObject( Some_Stupid_Object ) )
{
Some_Stupid_Object = CreateObject( ... );
}
//OnPlayerRequestSpawn
if( IsValidObject( Some_Stupid_Object ) )
{
DestroyObject( Some_Stupid_Object );
Some_Stupid_Object = -1;
}
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;
}
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;
}
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;
}