GivePlayerWeaponData does not work correctly
#1

Код:
CMD:gub(playerid)
{
    new ammo2, weapon=0;
    GetPlayerWeaponData(playerid, 2, weapon, ammo2);
    if(weapon!=22 && weapon!=23 && weapon!=24)
	{
    GivePlayerWeapon(playerid, 24, 3);
	}
    else
	{
    new string[99];
    format(string, sizeof(string), "Weapon slot taken %i", weapon);
    SendClientMessage(playerid, -1, string);
    }

return 1;
}
I type /gub I get deagle. I empty the mag and gun dissappears. Then I type /gub again and I get message "Weapon slot taken 24" (24 = deagle) even thought I don't have a deagle since I shoot all the bullets and it dissappeared
Reply
#2

Try this:
PHP код:
CMD:gub(playerid)
{
    new 
ammo2weapon=0;
    
GetPlayerWeaponData(playerid2weaponammo2);
    if((
weapon !=22 && weapon !=23 && weapon !=24) || ammo2 == 0)
    {
    
GivePlayerWeapon(playerid243);
    }
    else
    {
    new 
string[99];
    
format(stringsizeof(string), "Weapon slot taken %i"weapon);
    
SendClientMessage(playerid, -1string);
    }
return 
1;

Reply
#3

Quote:
Originally Posted by DarkSkull
Посмотреть сообщение
Try this:
PHP код:
CMD:gub(playerid)
{
    new 
ammo2weapon=0;
    
GetPlayerWeaponData(playerid2weaponammo2);
    if((
weapon !=22 && weapon !=23 && weapon !=24) || ammo2 == 0)
    {
    
GivePlayerWeapon(playerid243);
    }
    else
    {
    new 
string[99];
    
format(stringsizeof(string), "Weapon slot taken %i"weapon);
    
SendClientMessage(playerid, -1string);
    }
return 
1;

Thanks, havent thought about this
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)