SA-MP Forums Archive
Solved - 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: Solved (/showthread.php?tid=156881)



Solved - [MK]Soprano - 24.06.2010

How to check if the player has a М4, if he has nothing in hand

For example I have a MP5 in hand and now how to check if I have M4 in me




Re: How to Check this ? - Hiddos - 24.06.2010

pawn Код:
new w,a;
GetPlayerWeaponData(playerid,5,w,a);
if(w == 31 && a != 0) return 1;



Re: How to Check this ? - [MK]Soprano - 24.06.2010



forward CheckMissionWeapon();
public CheckMissionWeapon()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
new w,a;
GetPlayerWeaponData(i,5,w,a);
if(w != 31)
{
SendClientMessage(i, COLOR_WHITE, "You not have M4 so you can't pass this mission");
}
}
}
return 1;
}



But not work

Any Help


Re: How to check this ? - MadeMan - 24.06.2010

Replace "playerid" with "i"

pawn Код:
SendClientMessage(i, COLOR_WHITE, "You not have M4 so you can't pass this mission");



Re: How to check this ? - [MK]Soprano - 24.06.2010

i replaced but it stil not work

Any Help ?


Re: How to check this ? - MadeMan - 24.06.2010

How do you use this function CheckMissionWeapon() ?


Re: How to check this ? - [MK]Soprano - 24.06.2010

ongamemodeinit

SetTimer("CheckMissionWeapon", 1000, 1);//Spam message if player not have M4






Re: How to check this ? - Jefff - 24.06.2010

Remove first return 1; it blocks loop


Re: How to check this ? - [MK]Soprano - 24.06.2010

haha tnx

SOLVED