[HELP] GetPlayerWeapon with a Command! - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] GetPlayerWeapon with a Command! (
/showthread.php?tid=106034)
[HELP] GetPlayerWeapon with a Command! -
Lynax - 01.11.2009
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?
Re: [HELP] GetPlayerWeapon with a Command! -
SpiderPork - 01.11.2009
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;
}
Re: [HELP] GetPlayerWeapon with a Command! -
introzen - 01.11.2009
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...
Re: [HELP] GetPlayerWeapon with a Command! -
Lynax - 01.11.2009
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
Re: [HELP] GetPlayerWeapon with a Command! -
Synkro93 - 01.11.2009
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;
}
Re: [HELP] GetPlayerWeapon with a Command! -
TheNooB - 01.11.2009
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;
}
Re: [HELP] GetPlayerWeapon with a Command! -
MenaceX^ - 01.11.2009
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?
Re: [HELP] GetPlayerWeapon with a Command! -
TheNooB - 01.11.2009
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
Re: [HELP] GetPlayerWeapon with a Command! -
Dresden - 01.11.2009
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?