Solved
#1

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

Reply
#2

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



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
Reply
#4

Replace "playerid" with "i"

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

i replaced but it stil not work

Any Help ?
Reply
#6

How do you use this function CheckMissionWeapon() ?
Reply
#7

ongamemodeinit

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



Reply
#8

Remove first return 1; it blocks loop
Reply
#9

haha tnx

SOLVED

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)