Help: Pickup Weapon
#1

hello friends, i need defined "GiveDodWeapon", I have copied this code and dont know the way fix it.

PHP код:
CMD:pickupweapon(playeridparams[])
{
    if(
GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) return 1;
    new 
slot = -1;
    new 
Float:xFloat:yFloat:z;
    for(new 
0MAX_OBJi++)
        if(
dGunData[i][ObjData][0] > && IsValidObject(dGunData[i][ObjData][0]))
        {
            
GetObjectPos(dGunData[i][ObjData][0], xyz);
            if(
IsPlayerInRangeOfPoint(playerid5.0xyz))
            {
                
slot i;
                break;
            }
        }
    if(
slot 0) return SendClientMessage(playerid0x33AA3300"You are not near the weapon which you can pick up!");
    
DestroyObject(dGunData[slot][ObjData][0]);
    
GiveDodWeapon (playeriddGunData[slot][ObjData][1], dGunData[slot][ObjData][2]); // <---- error line
    
dGunData[slot][ObjData][0] = 0;
    new 
buffer[50];
    
format(buffersizeof(buffer), "You picked up %s"GunNames[dGunData[slot][ObjData][1]]);
    
SendClientMessage(playerid0x33AA3300buffer);
    return 
1;

PHP код:
C:\Users\1320703\Desktop\GTA3\server2\gamemodes\Kon4.pwn(21523) : error 017undefined symbol "GiveDodWeapon"
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
1 Error

Reply
#2

I solve it

PHP код:
GiveDodWeapon (playeriddGunData[slot][ObjData][1], dGunData[slot][ObjData][2]); // <---- error line
    
GivePlayerWeapon (playeriddGunData[slot][ObjData][1], dGunData[slot][ObjData][2]); //<--- this is right :) 
Reply
#3

This is code DROP/PICKUP weapon:

PHP код:
#define MAX_OBJ 50
enum dGunEnum
{
    
ObjData[3]
};
new 
dGunData[MAX_OBJ][dGunEnum];
new 
GunNames[48][] = {
    
"Nothink""Brass Knuckles""Golf Club""Nitestick""Knife""Baseball Bat",
    
"Showel""Pool Cue""Katana""Chainsaw""Purple Dildo""Small White Dildo",
    
"Long White Dildo""Vibrator""Flowers""Cane""Grenade""Tear Gas""Molotov",
    
"Vehicle Missile""Hydra Flare""Jetpack""Glock""Silenced Colt""Desert Eagle",
    
"Shotgun""Sawn Off""Combat Shotgun""Micro UZI""MP5""AK47""M4""Tec9",
    
"Rifle""Sniper Rifle""Rocket Launcher""HS Rocket Launcher""Flamethrower""Minigun",
    
"Satchel Charge""Detonator""Spraycan""Fire Extinguisher""Camera""Nightvision",
    
"Infrared Vision""Parachute""Fake Pistol"
};
new 
GunObjects[47] = {
    
0,331,333,334,335,336,337,338,339,341,321,322,323,324,325,326,342,343,344,
    
0,0,0,346,347,348,349,350,351,352,353,355,356,372,357,358,359,360,361,362,
    
363,364,365,366,367,368,368,371
};
stock RemovePlayerWeapon(playeridweaponid)
{
    new 
plyWeapons[12];
    new 
plyAmmo[12];
    for(new 
slot 0slot != 12slot++)
    {
        new 
wepammo;
        
GetPlayerWeaponData(playeridslotwepammo);
        if(
wep != weaponid)
        {
            
GetPlayerWeaponData(playeridslotplyWeapons[slot], plyAmmo[slot]);
        }
    }
    
ResetPlayerWeapons(playerid);
    for(new 
slot 0slot != 12slot++)
    {
        
GivePlayerWeapon(playeridplyWeapons[slot], plyAmmo[slot]);
    }
}
CMD:d(playeridparams[])
{
    if(
GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) return 1;
    new 
GunID GetPlayerWeapon(playerid);
    new 
GunAmmo GetPlayerAmmo(playerid);
    if(
GunID && GunAmmo 0)
    {
        new 
slot = -1;
        for(new 
0MAX_OBJi++)
            if(
dGunData[i][ObjData][0] == 0)
            {
                
slot i;
                break;
            }
        if(
slot 0) return SendClientMessage(playerid0x33AA3300"You can not throw weapons at the moment, try back later!");
        
RemovePlayerWeapon(playeridGunID);
        
dGunData[slot][ObjData][1] = GunID;
        
dGunData[slot][ObjData][2] = GunAmmo;
        new 
Float:xFloat:yFloat:z;
        
GetPlayerPos(playeridxyz);
        
dGunData[slot][ObjData][0] = CreateObject(GunObjects[GunID], xyz-1.093.7120.0120.0);
        new 
buffer[50];
        
format(buffersizeof(buffer), "You threw %s"GunNames[dGunData[slot][ObjData][1]]);
        
SendClientMessage(playerid0x33AA3300buffer);
    }
    return 
1;
}
CMD:pickupweapon(playeridparams[])
{
    if(
GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) return 1;
    new 
slot = -1;
    new 
Float:xFloat:yFloat:z;
    for(new 
0MAX_OBJi++)
        if(
dGunData[i][ObjData][0] > && IsValidObject(dGunData[i][ObjData][0]))
        {
            
GetObjectPos(dGunData[i][ObjData][0], xyz);
            if(
IsPlayerInRangeOfPoint(playerid5.0xyz))
            {
                
slot i;
                break;
            }
        }
    if(
slot 0) return SendClientMessage(playerid0x33AA3300"You are not near the weapon which you can pick up!");
    
DestroyObject(dGunData[slot][ObjData][0]);
    
GivePlayerWeapon(playeriddGunData[slot][ObjData][1], dGunData[slot][ObjData][2]);
    
dGunData[slot][ObjData][0] = 0;
    new 
buffer[50];
    
format(buffersizeof(buffer), "You picked up %s"GunNames[dGunData[slot][ObjData][1]]);
    
SendClientMessage(playerid0x33AA3300buffer);
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)