SA-MP Forums Archive
pickgun command help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: pickgun command help (/showthread.php?tid=568897)



pickgun command help - Rabea - 26.03.2015

Hello,
When i /pickgun from the ground, i take the gun but the object keeps in the ground, also there is
pawn Код:
DestroyObject(dGunData[f][ObjID]);
but its the same problem
Any help?
pawn Код:
CMD:pickgun(playerid, params[])
{
    if(GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) return 1;
    new f = MAX_OBJ+1;
    for(new a = 0; a < MAX_OBJ; a++)
    {
        if(IsPlayerInRangeOfPoint(playerid, 5.0, dGunData[a][ObjPos][0], dGunData[a][ObjPos][1], dGunData[a][ObjPos][2]))
        {
            f = a;
            break;
        }
    }
    if(f > MAX_OBJ) return SendClientMessage(playerid, COLOR_GREY, "You are not near the weapon which you can pick up.");
    GiveZaiatWeapon(playerid, dGunData[f][ObjData][0], dGunData[f][ObjData][1]);
    DestroyObject(dGunData[f][ObjID]);
    dGunData[f][ObjPos][0] = 0.0;
    dGunData[f][ObjPos][1] = 0.0;
    dGunData[f][ObjPos][2] = 0.0;
    dGunData[f][ObjID] = -1;
    //dGunData[f][ObjData][0] = 0;
    dGunData[f][ObjData][1] = 0;
    new string[128];
    format(string, sizeof(string), "* %s took a gun from the ground", RPN(playerid), GunNames[dGunData[f][ObjData][0]]);
    if(PlayerInfo[playerid][pMaskOn] == 1)
    {
        format(string, sizeof(string), "* Stranger took a gun from the ground", GunNames[dGunData[f][ObjData][0]]);
    }
    else
    {
        format(string, sizeof(string), "* %s took a gun from the ground", RPN(playerid), GunNames[dGunData[f][ObjData][0]]);
    }
    SendNearbyMessage(playerid, 15, string, COLOR_LIGHTBLUE, COLOR_LIGHTBLUE, COLOR_LIGHTBLUE, COLOR_LIGHTBLUE, COLOR_LIGHTBLUE);
    return 1;
}



Re: pickgun command help - Aly - 26.03.2015

Aren't you using a streamer? If you are, replace :
Код:
DestroyObject(dGunData[f][ObjID]);
with:
Код:
DestroyDynamicObject(dGunData[f][ObjID]);



Re: pickgun command help - Rabea - 26.03.2015

Quote:
Originally Posted by Aly
Посмотреть сообщение
Aren't you using a streamer? If you are, replace :
Код:
DestroyObject(dGunData[f][ObjID]);
with:
Код:
DestroyDynamicObject(dGunData[f][ObjID]);
Thanks thanks! +rep