Give a weapon help
#1

Alright here my command
Код:
if (strcmp("/ak47", cmdtext, true, 10) == 0)
	{
	if(GetPlayerWeapon(playerid) == 30)
	SendClientMessage(playerid,0xB4B5B7FF,"--------------------------------------------");
	SendClientMessage(playerid,0xB4B5B7FF,"You already have an AK-47 foul.");
	SendClientMessage(playerid,0xB4B5B7FF,"--------------------------------------------");
	GivePlayerWeapon(playerid, 30,1000);
    else
	SendClientMessage(playerid,0xB4B5B7FF,"--------------------------------------------");
	SendClientMessage(playerid,0xB4B5B7FF,"Here is you AK-47 now run off nub");
	SendClientMessage(playerid,0xB4B5B7FF,"--------------------------------------------");
	GivePlayerWeapon(playerid, 30,1000);
	return 1;
	}
But the else doesnt work what can i do now? i want it if he doesnt have it he get it but if he have it then he can have it twice
Reply
#2

Try this:

pawn Код:
if (strcmp("/ak47", cmdtext, true, 10) == 0)
{
    new weap, ammo;
    GetPlayerWeaponData(i, 5, weap, ammo);
    if(weap == 30)
    {
        SendClientMessage(playerid,0xB4B5B7FF,"--------------------------------------------");
        SendClientMessage(playerid,0xB4B5B7FF,"You already have an AK-47 foul.");
        SendClientMessage(playerid,0xB4B5B7FF,"--------------------------------------------");
    }
    else
    {
        SendClientMessage(playerid,0xB4B5B7FF,"--------------------------------------------");
        SendClientMessage(playerid,0xB4B5B7FF,"Here is you AK-47 now run off nub");
        SendClientMessage(playerid,0xB4B5B7FF,"--------------------------------------------");
        GivePlayerWeapon(playerid, 30,1000);
    }
    return 1;
}
Reply
#3

you forgot the weap and the ammo , also i have command for giving gun

Код:
	if(strcmp(cmd, "/givegun", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GREY, "USAGE: /givegun [Playerid/PartOfName] [WeaponID]");
				SendClientMessage(playerid, COLOR_WHITE, "*** Weapon IDs ***");
				SendClientMessage(playerid, COLOR_GRAD2, "|1 Brass Knuckles|2 Golf Club|3 Nite Stick|4 Knife|5 Baseball Bat|6 Shovel|7 Pool Cue|8 Katana| ");
				SendClientMessage(playerid, COLOR_GRAD2, "|9 Chainsaw|10 Purple Dildo|11 Small White Vibrator|12 Large White Vibrator|13 Silver Vibrator|");
				SendClientMessage(playerid, COLOR_GRAD2, "|14 Flowers|15 Cane|16 Gernade|17 Tear Gas|18 Molotov Cocktail|22 Pistol|23 SDPistol|24 Desert Eagle|");
				SendClientMessage(playerid, COLOR_GRAD2, "|25 Shotgun|26 Sawnoffs|27 SPAS12|28 UZI|29 MP5|30 AK47|31 M4|32 Tec9|33 Rifle|34 Sniper Rifle| ");
				SendClientMessage(playerid, COLOR_GRAD2, "|35 Rocket Launcher|36 HeatSeeker Rocket Launcher|37 Flamethrower|38 Minigun|41 Spraycan|");
				SendClientMessage(playerid, COLOR_GRAD2, "|42 Fire Extinguisher|43 Camera|44 Nightvision Goggles|45 Infrared Vision|46 Parachute| ");
				return 1;
			}
			new playa;
			new gun;
			playa = ReturnUser(tmp);
			tmp = strtok(cmdtext, idx);
			gun = strval(tmp);
			if(gun < 1||gun > 46)
			{ SendClientMessage(playerid, COLOR_GRAD1, "   wrong WeaponID!"); return 1; }
			if (PlayerInfo[playerid][pAdmin] >= 4)
			{
			    if(IsPlayerConnected(playa))
			    {
			        if(playa != INVALID_PLAYER_ID)
			        {
						GivePlayerWeapon(playa, gun, 650000);
						PlayerInfo[playa][pAdmingave] = 1;
					}
				}
			}
			else
			{
			    SendClientMessage(playerid, COLOR_GRAD1, "   you are not authorized to use that command!");
			}
		}
		return 1;
	}
Reply
#4

Nvm gotta try u
Reply
#5

Quote:
Originally Posted by matdav
Посмотреть сообщение
Alright here my command
Код:
if (strcmp("/ak47", cmdtext, true, 10) == 0)
	{
	if(GetPlayerWeapon(playerid) == 30)
	SendClientMessage(playerid,0xB4B5B7FF,"--------------------------------------------");
	SendClientMessage(playerid,0xB4B5B7FF,"You already have an AK-47 foul.");
	SendClientMessage(playerid,0xB4B5B7FF,"--------------------------------------------");
	GivePlayerWeapon(playerid, 30,1000);
    else
	SendClientMessage(playerid,0xB4B5B7FF,"--------------------------------------------");
	SendClientMessage(playerid,0xB4B5B7FF,"Here is you AK-47 now run off nub");
	SendClientMessage(playerid,0xB4B5B7FF,"--------------------------------------------");
	GivePlayerWeapon(playerid, 30,1000);
	return 1;
	}
But the else doesnt work what can i do now? i want it if he doesnt have it he get it but if he have it then he can have it twice
Код:
if (strcmp("/ak47", cmdtext, true, 10) == 0)
{
	if(GetPlayerWeapon(playerid) == 30)
    {
	SendClientMessage(playerid,0xB4B5B7FF,"--------------------------------------------");
	SendClientMessage(playerid,0xB4B5B7FF,"You already have an AK-47 fool.");
	SendClientMessage(playerid,0xB4B5B7FF,"--------------------------------------------");
    }
    else
    {
	SendClientMessage(playerid,0xB4B5B7FF,"--------------------------------------------");
	SendClientMessage(playerid,0xB4B5B7FF,"Here is you AK-47 now run off nub");
	SendClientMessage(playerid,0xB4B5B7FF,"--------------------------------------------");
	GivePlayerWeapon(playerid, 30,1000);
	return 1;
    }
}
Reply
#6

Quote:
Originally Posted by TheKingOfSamp
Посмотреть сообщение
you forgot the weap and the ammo , also i have command for giving gun

Код:
	if(strcmp(cmd, "/givegun", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GREY, "USAGE: /givegun [Playerid/PartOfName] [WeaponID]");
				SendClientMessage(playerid, COLOR_WHITE, "*** Weapon IDs ***");
				SendClientMessage(playerid, COLOR_GRAD2, "|1 Brass Knuckles|2 Golf Club|3 Nite Stick|4 Knife|5 Baseball Bat|6 Shovel|7 Pool Cue|8 Katana| ");
				SendClientMessage(playerid, COLOR_GRAD2, "|9 Chainsaw|10 Purple Dildo|11 Small White Vibrator|12 Large White Vibrator|13 Silver Vibrator|");
				SendClientMessage(playerid, COLOR_GRAD2, "|14 Flowers|15 Cane|16 Gernade|17 Tear Gas|18 Molotov Cocktail|22 Pistol|23 SDPistol|24 Desert Eagle|");
				SendClientMessage(playerid, COLOR_GRAD2, "|25 Shotgun|26 Sawnoffs|27 SPAS12|28 UZI|29 MP5|30 AK47|31 M4|32 Tec9|33 Rifle|34 Sniper Rifle| ");
				SendClientMessage(playerid, COLOR_GRAD2, "|35 Rocket Launcher|36 HeatSeeker Rocket Launcher|37 Flamethrower|38 Minigun|41 Spraycan|");
				SendClientMessage(playerid, COLOR_GRAD2, "|42 Fire Extinguisher|43 Camera|44 Nightvision Goggles|45 Infrared Vision|46 Parachute| ");
				return 1;
			}
			new playa;
			new gun;
			playa = ReturnUser(tmp);
			tmp = strtok(cmdtext, idx);
			gun = strval(tmp);
			if(gun < 1||gun > 46)
			{ SendClientMessage(playerid, COLOR_GRAD1, "   wrong WeaponID!"); return 1; }
			if (PlayerInfo[playerid][pAdmin] >= 4)
			{
			    if(IsPlayerConnected(playa))
			    {
			        if(playa != INVALID_PLAYER_ID)
			        {
						GivePlayerWeapon(playa, gun, 650000);
						PlayerInfo[playa][pAdmingave] = 1;
					}
				}
			}
			else
			{
			    SendClientMessage(playerid, COLOR_GRAD1, "   you are not authorized to use that command!");
			}
		}
		return 1;
	}
He only wants this for his AK gun. Why don't you read ANY posts before responding. Your really annoying me with all of your useless and spamish replies.
Reply
#7

i know he's just needs ak but i just helpin'
Reply
#8

Quote:
Originally Posted by TheKingOfSamp
Посмотреть сообщение
i know he's just needs ak but i just helpin'
Posting unrelated crap is not considered helping.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)