A /giveweapon Command?
#1

I basically want
/giveweapon playerid, gunid, ammonumber
or somthing along the lines of that
thanks for the help
Reply
#2

Here:

Quote:

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_USEJET PACK);
}
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;
}

Reply
#3

C:\Documents and Settings\slim\Desktop\Server\gamemodes\Gamemode.pw n(163) : error 017: undefined symbol "cmd"
C:\Documents and Settings\slim\Desktop\Server\gamemodes\Gamemode.pw n(167) : error 017: undefined symbol "PlayerInfo"
C:\Documents and Settings\slim\Desktop\Server\gamemodes\Gamemode.pw n(167) : warning 215: expression has no effect
C:\Documents and Settings\slim\Desktop\Server\gamemodes\Gamemode.pw n(167) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\slim\Desktop\Server\gamemodes\Gamemode.pw n(167) : error 029: invalid expression, assumed zero
C:\Documents and Settings\slim\Desktop\Server\gamemodes\Gamemode.pw n(167) : fatal error 107: too many error messages on one line

any help here?
Reply
#4

Sure thing, add me on msn i will help you out over teamviewer? wacko09@hotmail.co.uk or contact me at my server forums - www.velocity-roleplay.tk
Reply
#5

Forget my old post. IVe done it for you now it should work, I thought you had a GF edit or something Hope you enjoy
Reply
#6

Hah thatnks, no its all mine.
Reply
#7

Didnt work, anybody got TV? PM me and then ill PM back my details!
Reply
#8

with SSCANF + ZCMD:

pawn Код:
CMD:giveweapon(playerid,params[])
{
    new ID, GUN, AMMO;//Creates th variables
    if(sscanf(params, "uii", ID, GUN, AMMO)) return SendClientMessage(playerid,-1,"Usage: /giveweapon [gunid] [ammo]");//if the player enters the wrong params
    if(GUN == 0 || GUN >= 45) return SendClientMessage(playerid, -1, "Invalid gunid!");//if the gunid is invalid
    if(IsPlayerConnected(ID) && ID != INVALID_PLAYER_ID)//if the player is connected and is valid
    {
        GivePlayerWeapon(ID, GUN, AMMO);//Gives the GUN and AMMO specified
        SendClientMessage(ID, -1, "Someone gave you a gun!");//Sends a message to the player that they received a gun
    }
    return 1;
}
Note: Untested.
Reply
#9

nvm@(
Reply
#10

Quote:
Originally Posted by PhoenixB
Посмотреть сообщение
Here:
lmao @ SARP Script.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)