Jump to content

Despre verificarea tastelor apasate de jucator


WopsS

Recommended Posts

ATENTIE! NU folositi

newkeys == macro-ul_comenzii

de exemplu

newkeys == KEY_FIRE

la OnPlayerKeyStateChange.

De ce?

Pentru ca newkeys nu va mai fi la fel ca KEY_FIRE in anumite cazuri.

Pai incercati sa luati un pistol si pune-ti tinta si sa incepeti sa trageti, sa vedeti daca se mai executa instructiunile / instructiunea.

Exemplul este acest cod

if (newkeys == KEY_FIRE)
{
	SendClientMessage(playerid, -1, "Ai tras!");
}

Acum stergeti == si scrieti & (operatorul SI pe biti), acum o sa va mearga.

Poate va intrebati de ce nu a mers, pai nu a mers pentru ca acum valoarea lui newkeys o sa fie KEY_FIRE combinat cu KEY_HANDBRAKE / KEY_AIM.

Edited by WopsS
  • Upvote 4
Link to comment
Share on other sites

  • WopsS pinned and featured this topic
  • 1 month later...

 

if (newkeys == KEY_FIRE)
{
	SendClientMessage(playerid, -1, "Ai tras!");
}

 

aici nu trebuia 

 

if ((newkeys ==  KEY_FIRE ) && (IsPlayerInAnyVehicle(playerid)

{

        SendClientMessage(playerid, -1, "AI tras!");

}

 

P.S Doar intreb, deci fara jigniri!

Edited by KelToN.BloWn

                               http://i.imgur.com/NOsIYWt.png

                     Respecta si vei fi respectat. :)

Link to comment
Share on other sites

 

aici nu trebuia 

 

P.S Doar intreb, deci fara jigniri!

Nu, nu e bine.

Ceea ce ai incercat tu sa faci e ca acel mesaj in chat sa apara doar daca esti intr-un vehicul.

Codul corect ar fi:

if(newkeys == KEY_FIRE && IsPlayerAnyVehicle(playerid))
{
    SendClientMessage(playerid, -1, "Ai apasat Click fiind intr-un vehicul!");
}

 

242086.png

Link to comment
Share on other sites

On 06/30/2015 at 2:20 PM, KelToN.BloWn said:

 

aici nu trebuia 

 

P.S Doar intreb, deci fara jigniri!

Nu, acolo nu voiam sa vad daca jucatorul este in masina si trage voiam doar sa vad daca trage.

P.S:Corect ar fi ca asta

newkeys ==  KEY_FIRE

sa fie

newkeys & KEY_FIRE

Cum am zis si mai jos.

Link to comment
Share on other sites

  • WopsS unpinned and pinned this topic
  • WopsS unfeatured this topic
  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.