[HELP] GetPlayerWeapon with a Command!
#1

http://pastebin.com/m6f50ce4d

This is my script. It dont give warning but /silahal (in english: /getgun ) is not working..
What is wrong? can you help me?
Reply
#2

pawn Код:
if (strcmp("/silahal", cmdtext, true, 10) == 0)
{
   new string[24];
   format(string, sizeof(string), "Current Weapon: %d", GetPlayerWeapon(playerid));
   SendClientMessage(playerid, color, string);
   return 1;
}
Reply
#3

Are you trying to give the person a weapon? Use

GivePlayerWeapon(playerid,weaponid,ammo);


GetPlayerWeapon is to see what weapon a player has in his hands...
Reply
#4

Quote:
Originally Posted by IntrozeN
Are you trying to give the person a weapon? Use

GivePlayerWeapon(playerid,weaponid,ammo);


GetPlayerWeapon is to see what weapon a player has in his hands...
No warning but don't work. :S
Reply
#5

Quote:
Originally Posted by |»Lynax«| Kerim™
Quote:
Originally Posted by IntrozeN
Are you trying to give the person a weapon? Use

GivePlayerWeapon(playerid,weaponid,ammo);


GetPlayerWeapon is to see what weapon a player has in his hands...
No warning but don't work. :S
pawn Код:
if (strcmp("/silahal", cmdtext, true, 10) == 0)
{
   GivePlayerWeapon(playerid, 24, 50);
   return 1;
}
Reply
#6

Weapon Name, Weapon ID, Weapon Ammo

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp("/silahal", cmdtext, true, 10) == 0)
    {
    new weaponid = GetPlayerWeapon(playerid);
    new WeaponName[128];
    new string[128];
    GetWeaponName(weaponid, WeaponName, sizeof WeaponName);

    format(string, sizeof string, "Current Weapon: %s(Weapon ID: %d) Ammo: %d", WeaponName, GetPlayerWeapon(playerid), GetPlayerAmmo(playerid));
    SendClientMessage(playerid,0xF60000AA, string);
    return 1;
    }
    return 0;
}
Reply
#7

Quote:
Originally Posted by TheNooB
Weapon Name, Weapon ID, Weapon Ammo

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp("/silahal", cmdtext, true, 10) == 0)
    {
    new weaponid = GetPlayerWeapon(playerid);
    new WeaponName[128];
    new string[128];
    GetWeaponName(weaponid, WeaponName, sizeof WeaponName);

    format(string, sizeof string, "Current Weapon: %s(Weapon ID: %d) Ammo: %d", WeaponName, GetPlayerWeapon(playerid), GetPlayerAmmo(playerid));
    SendClientMessage(playerid,0xF60000AA, string);
    return 1;
    }
    return 0;
}
Why is WeaponName such a big array?
Reply
#8

Quote:
Originally Posted by MenaceX^
Quote:
Originally Posted by TheNooB
Weapon Name, Weapon ID, Weapon Ammo

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp("/silahal", cmdtext, true, 10) == 0)
    {
    new weaponid = GetPlayerWeapon(playerid);
    new WeaponName[128];
    new string[128];
    GetWeaponName(weaponid, WeaponName, sizeof WeaponName);

    format(string, sizeof string, "Current Weapon: %s(Weapon ID: %d) Ammo: %d", WeaponName, GetPlayerWeapon(playerid), GetPlayerAmmo(playerid));
    SendClientMessage(playerid,0xF60000AA, string);
    return 1;
    }
    return 0;
}
Why is WeaponName such a big array?
I like to write
Reply
#9

Quote:
Originally Posted by TheNooB
I like to write
He means: Why are you taking so many possible characters when you know your string is going to be at the most something like 50 characters long?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)