Arguement type mismatch (arguement 1)
#1

Goin' straight to the point

PHP код:
new ObjectID[100][2];
CMD:pickupgun(playeridparams[])
{
    new 
100+1;
    for(new 
0sizeof(ObjCoords); a++) {
        if(
IsPlayerInRangeOfPoint(playerid5.0ObjCoords[a][0], ObjCoords[a][1], ObjCoords[a][2])) {
            
a;
            break;
        }
    }
    if(
100) return SendClientMessage(playeridCOLOR_GREY"You are not near the weapon which you can pick up!");
    if(
GetPlayerState(playerid) != 1) return SendClientMessage(playeridCOLOR_GREY"   You must be on foot !");
    if(
GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) return SendClientMessage(playeridCOLOR_GREY" You must be crouched to pick a gun.");
    else {
        new 
gunname[25], string[128];
        new 
buffer[100];
        
ObjCoords[f][0] = 0.0;
        
ObjCoords[f][1] = 0.0;
        
ObjCoords[f][2] = 0.0;
        
DestroyDynamicObject(object[f]);
        
GivePlayerWeapon(playeridObjectID[f][0]); //ERRORLINE
        
GetWeaponName(ObjectID[f][0], gunnamesizeof(gunname));
        
format(buffersizeof(buffer), "You picked up a %s"gunname);
        
SendClientMessage(playerid0x33AA3300buffer);
        
format(stringsizeof(string), "* %s has picked up a %s."PlayerName(playerid), gunname);
        
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    }
    return 
1;
}
CMD:dropgun(playeridparams[])
{
    if(
IsPlayerInAnyVehicle(playerid)) {
        
SendClientMessage (playeridCOLOR_GRAD2"You can not drop weapons in a vehicle!");
        return 
1;
    }
    new 
gunid GetPlayerWeapon(playerid);
    if(
gunid) {
        new 
100+1;
        for(new 
0sizeof(ObjCoords); a++) {
            if(
ObjCoords[a][0] == 0.0) {
                
a;
                break;
            }
        }
        if(
100) return SendClientMessage(playeridCOLOR_GREY"You can not throw weapons at the moment!");
        new 
WeaponName[65];
        new 
string[128];
        
GetWeaponName(gunidWeaponName64);
        if(
gunid == 18) { WeaponName "Molotovs"; }
        if(
gunid == 44) { WeaponName "Nightvision Goggles"; }
        if(
gunid == 45) { WeaponName "Infared Goggles"; }
        
RemovePlayerWeapon(playerid,gunid);
        
ObjectID[f][0] = gunid;
        
GetPlayerPos(playeridObjCoords[f][0], ObjCoords[f][1], ObjCoords[f][2]);
        
object[f] = CreateDynamicObject(GunObjects[gunid][0],ObjCoords[f][0],ObjCoords[f][1],ObjCoords[f][2]-1,93.7,120.0,120.0GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), -1100.0);
        
SetTimerEx("DeleteGun"5000000"d"object[f]);
        
format(stringsizeof(string), "* %s has thrown away their %s."PlayerName(playerid), WeaponName);
        
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        }
    else
    {
        
SendClientMessage(playeridCOLOR_GRAD1"You must have atleast 1 gun");
    }
    return 
1;

Reply
#2

GivePlayerWeapon has 3 parameters not 2 look it up
(you were missing the ammo)
Reply
#3

Whoops. Forgot 'bout that
Reply
#4

Quote:
Originally Posted by NealPeteros
Посмотреть сообщение
Whoops. Forgot 'bout that
also, are you trying to give an actual object as a weapon?
or does ObjectID[f][0] hold a valid id?
here are the weapon id's use these if not: https://sampwiki.blast.hk/wiki/Weapons
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)