/givegun
#1

I'm trying to script a /givegun cmd i found a one on fourms here is it
pawn Код:
if(strcmp(cmd, "/givegun", true) == 0)
 {
 if(IsPlayerConnected(playerid))
 {
 if(PlayerInfo[playerid][pAdmin] < 4)
 {
 SendClientMessage(playerid, COLOR_GRAD1, " You are not authorized to use that command !");
 return 1;
 }
 tmp = strtok(cmdtext, idx);
 if(!strlen(tmp))
 {
 SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givegun [playerid/PartOfName] [weaponid]");
 return 1;
 }
 new playa;
 new gun;
 playa = ReturnUser(tmp);
 tmp = strtok(cmdtext, idx);
 gun = strvalEx(tmp);
 if(!strlen(tmp))
 {
 SendClientMessage(playerid, COLOR_GREEN,"_____________________________________ __");
 SendClientMessage(playerid, COLOR_GRAD1, "1: Brass Knuckles 2: Golf Club 3: Nite Stick 4: Knife 5: Baseball Bat 6: Shovel 7: Pool Cue 8: Katana 9: Chainsaw");
 SendClientMessage(playerid, COLOR_GRAD2, "10: Purple Dildo 11: Small White Vibrator 12: Large White Vibrator 13: Silver Vibrator 14: Flowers 15: Cane 16: Frag Grenade");
 SendClientMessage(playerid, COLOR_GRAD3, "17: Tear Gas 18: Molotov Cocktail 19: Vehicle Missile 20: Hydra Flare 21: Jetpack 22: 9mm 23: Silenced 9mm 24: Deagle");
 SendClientMessage(playerid, COLOR_GRAD4, "26: Sawnoff Shotgun 27: Combat Shotgun 28: Micro SMG (Mac 10) 29: SMG (MP5) 30: AK-47 31: M4 32: Tec9 33: Country Rifle");
 SendClientMessage(playerid, COLOR_GRAD5, "25: Shotgun 34: Sniper Rifle 35: Rocket Launcher 36: HS Rocket Launcher 37: Flamethrower 38: Minigun 39: Satchel Charge");
 SendClientMessage(playerid, COLOR_GRAD6, "40: Detonator 41: Spraycan 42: Fire Extinguisher 43: Camera 44: Nightvision Goggles 45: Infared Goggles 46: Parachute");
 SendClientMessage(playerid, COLOR_GREEN,"_____________________________________ __");
 return 1;
 }
 if(gun < 1||gun > 46) { SendClientMessage(playerid, COLOR_GRAD1, " Invalid weaponid !"); return 1; }
 if(IsPlayerConnected(playa))
 {
 if(gun == 21)
 {
 SetPlayerSpecialAction(playa,SPECIAL_ACTION_USEJETPACK);
 }
 else
 {
 GivePlayerAdminGun(playa, gun);
 }
 GetPlayerName(playa, giveplayer, sizeof(giveplayer));
 format(string, sizeof(string), " You have given gun %d to %s!", gun,giveplayer);
 SendClientMessage(playerid, COLOR_GREY, string);
 }
 }
 return 1;
 }
and i get 1 error
pawn Код:
error 017: undefined symbol "GivePlayerAdminGun"
Reply
#2

You need to get the function GivePlayerAdminGun.
Reply
#3

from where and is there a function i cant use instead of that ?
Reply
#4

From the place in which you've stripped that command from. Might I also recommend switching to ZCMD or YCMD as a command processor? Faster and more efficient than using the 'strcmp method'.

An example of a command done in ZCMD and sscanf:

pawn Код:
CMD:giveweapon(playerid, params[])
{
    if(IsPlayerAdmin(playerid))
    {
        new id, weap, ammo, str[128], Sender[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME], WeapName[32];
        if(sscanf(params,"uii",id,weap,ammo)) return SendClientMessage(playerid,COLOR_GREY,"USAGE: /giveweapon [id] [weapon] [ammo]");
        if(!IsPlayerConnected(id)) return SendClientMessage(playerid,COLOR_GREY,"Player is not connected!");

        GetPlayerName(playerid,name,sizeof(name));
        GetPlayerName(id, Sender, sizeof(Sender));
        GetWeaponName(weap,WeapName,32);

        format(str,sizeof(str),"%s has given you a %s (%d) with %d Ammo.",name,WeapName,weap,ammo);
        SendClientMessage(id,COLOR_LIGHTBLUE,str);
        GivePlayerWeapon(id,weap,ammo);

        format(str,sizeof(str),"%AdmCmd: You have given %s a %s (%d) with %d Ammo.",Sender,WeapName,weap,ammo);
        SendClientMessage(playerid, COLOR_YELLOW,str);

    }
    else return 0;
    return 1;
}
Reply
#5

i didn't find it there
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)