17.02.2016, 13:32
i create playerobject this my code
then i DestroyPlayerObject with this command
object cannot destroy how to destroyplayerobject ??
PHP код:
new kardus; //global variable
forward proseskemas // timer
public proseskemas(playerid)
{
kardus = CreateObject(3013, 0.0,0.0, 0.0, 0.00000, 0.00000, 0.00000);
AttachObjectToPlayer(kardus,playerid,-0.00780, 0.41076, 0.30842, 0.00000, 0.00000, 0.00000);
TogglePlayerControllable(playerid, true);
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_CARRY);
AttachObjectToPlayer(kardus,playerid,-0.00780, 0.41076, 0.30842, 0.00000, 0.00000, 0.00000);
PlayerInfo[playerid][pkemas] = 0;
PlayerInfo[playerid][pjadi] = 1;
SendClientMessage(playerid, PURPLE, "proses selesai simpan di tempat jadi \n gunakan /simpanjadi");
}
CMD:prosesmentah(playerid, params[])
{
if (PlayerInfo[playerid][pFaction] == 3)
{
if(IsPlayerInRangeOfPoint(playerid, 8.0, 2489.1372,-2547.9502,9979.3379 ) || IsPlayerInRangeOfPoint(playerid, 8.0, 2483.7302,-2548.0552,9979.3379 ) || IsPlayerInRangeOfPoint(playerid, 8.0, 2477.1328,-2546.0029,9979.3379 ))
{
if (PlayerInfo[playerid][pmentah] == 1)
{
TogglePlayerControllable(playerid, 0);
SetTimerEx("proseskemas", 10000, false, "i", playerid); // called timmer
SetCameraBehindPlayer(playerid);
}
else SendClientMessage(playerid, COLOR_RED, "Kamu tidak punya bahan mentah ambil dulu di penyimpanan");
}
else SendClientMessage(playerid, COLOR_RED, "Kamu tidak di tempat pengolahan");
}
else SendClientMessage(playerid, COLOR_RED, "Kamu bukan pekerja pabrik");
return 1;
}
PHP код:
CMD:simpanjadi(playerid, params[])
{
if (PlayerInfo[playerid][pFaction] == 3)
{
if(IsPlayerInRangeOfPoint(playerid, 8.0,2464.3308,-2537.2014,9979.3379))
{
if (PlayerInfo[playerid][pjadi] == 1)
{
DestroyPlayerObject(playerid,kardus); // this destroyplayerobject
jadi += 1;
PlayerInfo[playerid][pjadi] = 0 ;
SetPlayerSpecialAction(playerid,0);
new jaaad[128];
format(jaaad, sizeof(jaaad), "bahan mentah tersedia %d/10000", jadi);
UpdateDynamic3DTextLabelText(jaditext, whijau, jaaad);
SendClientMessage(playerid, whijau, "bahan telah di simpan");
}
else
SendClientMessage(playerid, COLOR_RED, "Kamu tidak punya bahan jadi untuk disimpan");
}
else
SendClientMessage(playerid, COLOR_RED, "Kamu tidak di tempat bahan jadi");
}
else
SendClientMessage(playerid, COLOR_RED, "Kamu bukan pegawai pabrik");
return 1;
}