problem with DestroyPlayerObject
#1

i create playerobject this my code

PHP код:
 new kardus//global variable
forward proseskemas // timer
public proseskemas(playerid)
{
    
kardus CreateObject(30130.0,0.00.0,   0.000000.000000.00000);
    
AttachObjectToPlayer(kardus,playerid,-0.007800.410760.30842,   0.000000.000000.00000);
    
TogglePlayerControllable(playeridtrue);
    
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_CARRY);
    
AttachObjectToPlayer(kardus,playerid,-0.007800.410760.30842,   0.000000.000000.00000);
    
PlayerInfo[playerid][pkemas] = 0;
    
PlayerInfo[playerid][pjadi] = 1;
    
SendClientMessage(playeridPURPLE"proses selesai simpan di tempat jadi \n gunakan /simpanjadi");
}
CMD:prosesmentah(playeridparams[])
{
    if (
PlayerInfo[playerid][pFaction] == 3)
    {
        if(
IsPlayerInRangeOfPoint(playerid8.02489.1372,-2547.9502,9979.3379 ) || IsPlayerInRangeOfPoint(playerid8.02483.7302,-2548.0552,9979.3379 ) || IsPlayerInRangeOfPoint(playerid8.02477.1328,-2546.0029,9979.3379 ))
        {
            if (
PlayerInfo[playerid][pmentah] == 1)
            {
            
TogglePlayerControllable(playerid0);
            
SetTimerEx("proseskemas"10000false"i"playerid); // called timmer
             
SetCameraBehindPlayer(playerid);
             }
             else 
SendClientMessage(playeridCOLOR_RED"Kamu tidak punya bahan mentah ambil dulu di penyimpanan");
        }
        else 
SendClientMessage(playeridCOLOR_RED"Kamu tidak di tempat pengolahan");
    }
    else 
SendClientMessage(playeridCOLOR_RED"Kamu bukan pekerja pabrik");
    return 
1;

then i DestroyPlayerObject with this command
PHP код:
CMD:simpanjadi(playeridparams[])
{
if (
PlayerInfo[playerid][pFaction] == 3)
    {
        if(
IsPlayerInRangeOfPoint(playerid8.0,2464.3308,-2537.2014,9979.3379))
        {
            if (
PlayerInfo[playerid][pjadi] == 1)
            {
                
                
DestroyPlayerObject(playerid,kardus); // this destroyplayerobject
                
jadi += 1;
                
PlayerInfo[playerid][pjadi] = ;
                
SetPlayerSpecialAction(playerid,0);
                new 
jaaad[128];
                
format(jaaadsizeof(jaaad), "bahan mentah tersedia %d/10000"jadi);
                
UpdateDynamic3DTextLabelText(jaditextwhijaujaaad);
                
SendClientMessage(playeridwhijau"bahan telah di simpan");
            }
            else
            
SendClientMessage(playeridCOLOR_RED"Kamu tidak punya bahan jadi untuk disimpan");
        }
        else
          
SendClientMessage(playeridCOLOR_RED"Kamu tidak di tempat bahan jadi");
    }
    else
    
SendClientMessage(playeridCOLOR_RED"Kamu bukan pegawai pabrik");
return 
1;

object cannot destroy how to destroyplayerobject ??
Reply
#2

Reply
#3

----
Reply
#4

You're using CreateObject then DestroyPlayerObject... They're not related.

Use DestroyObject.


However, your code is going to run into problems. If more than one person uses this command, (In it's current state) it will lock the players object and won't destroy the first created object.

It's because this code only puts out one variable. Where you should use an array, set to MAX_PLAYERS, and use the playerid to specify that the players object e.g. DestroyObject(kardus[playerid]);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)