Weapons, please help me! -
Aleksabre - 16.09.2013
How to make when some player come in-front of the table he clicks F and the item of weapon shows him which weapon he wants to get? Thanks!
Re: Weapons, please help me! -
xganyx - 17.09.2013
first:
Use key N don't have Key F for SA:MP
use command /save where the table position
second:
goto Documents/GTA San Andreas User Files/SAMP/savedposition.txt
Open it and see the line pos
Код:
AddPlayerClass(number here is skin, this number is X pos, this is Y pos, this is Z pos, Angle, ....);
Copy the pos X, Pos Y, and Pos Z
third:
Goto the pawno and write this:
pawn Код:
#include <a_samp>
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys == KEY_NO) // this is key N
{
if(IsPlayerInRangeOfPoint(playerid,2.0,Pos X,Pos Y, Pos Z)) // this 3 pos is the X Y Z you just copy
{
ShowPlayerDialog(playerid,5000,DIALOG_STYLE_LIST,"Choose the weapon you want","9mm\ns9mm\nDE\nAK-47\nM4","Choose","Cancel");
}
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 5000)
{
if(response)
{
switch(lisitem)
{
case 0:
{
GivePlayerWeapon(playerid,22,900);
}
case 1:
{
GivePlayerWeapon(playerid,23,900);
}
case 2:
{
GivePlayerWeapon(playerid,24,900);
}
case 3:
{
GivePlayerWeapon(playerid,30,900);
}
case 4:
{
GivePlayerWeapon(playerid,31,900);
}
}
}
}
return 1;
}
Enjoy
Re: Weapons, please help me! -
Aleksabre - 17.09.2013
Thanks it works, but how do I make, instead of pressing N, to click enter to shows the weapons?
Re: Weapons, please help me! -
alinategh - 17.09.2013
that line, change it:
if(newkeys == KEY_SECONDARY_ATTACK ) // this is key Enter
Re: Weapons, please help me! -
Aleksabre - 17.09.2013
Cool, thanks. but when I click the weapon it doesn't give me, can you help me please?
Re: Weapons, please help me! -
Aleksabre - 17.09.2013
Help someone, when I click F or enter it shows the weapons and a dialogs such as |what i want to choose| (mp5,deagle,m4) when I choose m4 it doesn't give me, why? please help!
Re: Weapons, please help me! -
Aleksabre - 17.09.2013
and sorry for spamming if I do, this is a script what i've got;
{
if(newkeys == KEY_SECONDARY_ATTACK) // this is key Entetr
{
if(IsPlayerInRangeOfPoint(playerid,2.0,1261.1431,-1669.2919,25.2772)) // this 3 pos is the X Y Z you just copy
{
ShowPlayerDialog(playerid,5000,DIALOG_STYLE_LIST," Choose your weapons","Katana\nDeagle\nMP5\nM4\nGrenade\nParach ute\nSawnoff","Select","Cancel");
}
}
return 1;
}
this is on dialog response, up was a keystatechange
{
if(dialogid == 5000)
{
if(response)
{
switch(listitem)
{
case 0:
{
GivePlayerWeapon(playerid,8,10000);
}
case 1:
{
GivePlayerWeapon(playerid,24,10000);
}
case 2:
{
GivePlayerWeapon(playerid,29,10000);
}
case 3:
{
GivePlayerWeapon(playerid,31,10000);
}
case 4:
{
GivePlayerWeapon(playerid,16,10000);
}
case 5:
{
GivePlayerWeapon(playerid,46,10000);
}
case 6:
GivePlayerWeapon(playerid,26,10000);
}
}
}
return 1;
}
Re: Weapons, please help me! -
DanishHaq - 17.09.2013
Are you sure you've not got some type of anti-cheats that require you to use a different GivePlayerWeapon tactic?
Re: Weapons, please help me! -
Aleksabre - 17.09.2013
I think no, because guy above xyang helped me about it and he said this;
if(newkeys == KEY_NO) // this is key N
so I click N to choose the weapons, and guess what it worked, so when i've return from school, I've pmed him how to make that i press enter for weapons, he said this;
if(newkeys == KEY_SECONDARY_ATTACK) // this is key Enter
so when i came ingame, i clicked enter and the dialog of weapons work, when I choose any gun it doesn't give me, so I've had in mind, let's get back to "N" button, but still if I press N choose the weapon it doesn't give me, it's like, first time it works second time it's not. help me please :SS
Re: Weapons, please help me! -
DanishHaq - 17.09.2013
Can you show all of OnDialogResponse in [ pawn ] and [ / pawn ] tags? Without the spaces.