OnPlayerKeyStateChange.Help
#1

I made a cmd /plantbomb so when someone use its it creates an object and it gives him a detonator but the problem is here....I want to the function OnPlayerKeyStateChange when the player press the fire button,an explosion will be created but only if he has a detonator.

Look at this Lines:

First it was like this and it was working but the player was able to do it by punching or something:
Код:
if ((newkeys==KEY_FIRE))
	{
    	DestroyObject(bomb);
    	CreateExplosion(bomb_x[playerid], bomb_y[playerid], bomb_z[playerid], 12, 4.0);
	}
Then I made it like this:

Код:
if ((newkeys==KEY_FIRE && GetPlayerWeapon(playerid) == 40))
	{
    	DestroyObject(bomb);
    	CreateExplosion(bomb_x[playerid], bomb_y[playerid], bomb_z[playerid], 12, 4.0);
	}
But its not working.Help Please!!!
Reply
#2

Undefined symbol "GetPlayerArmedWeapon"
Reply
#3

GetPlayerWeapon just returns you weapon id in player's active slot. There is GetPlayerWeaponData if you want to get weapon ids and ammo amounts in specific slots.
Reply
#4

Yes i use 0.3 also i searched this function at wiki.sa-mp.com and i cant find it
Reply
#5

so how can i do it?can u give me the code?
Reply
#6

Quote:
Originally Posted by pierhs
so how can i do it?can u give me the code?
Not Sure, but try this:

pawn Код:
if (newkeys==KEY_FIRE)
{
  if (GetPlayerArmedWeapon(playerid) == 40)
  {
        DestroyObject(bomb);
        CreateExplosion(bomb_x[playerid], bomb_y[playerid], bomb_z[playerid], 12, 4.0);
  }
}
Reply
#7

You missed out the "if" BTW, i can read!

pawn Код:
if (GetPlayerWeaponData(playerid, 12, 40, 1))
see?
Reply
#8

Quote:
Originally Posted by $ЂЯĢ
GetPlayerWeapon just returns you weapon id in player's active slot. There is GetPlayerWeaponData if you want to get weapon ids and ammo amounts in specific slots.
No, it returns the weapon id of what you're holding.
Reply
#9

I get this:
Код:
C:\Documents and Settings\Terminal\ЕрйцЬнейб есгбуЯбт\The Simpsons Roleplay ™\gamemodes\gf.pwn(29479) : error 035: argument type mismatch (argument 3)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#10

Its on the same line with this "GetPlayerWeaponData"
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)