|
Re: HOW TO STOP KEY
[Re: cgcg]
#324045
05/19/10 09:19
05/19/10 09:19
|
Joined: Nov 2008
Posts: 196 the wrong place
Muhsin
Member
|
Member
Joined: Nov 2008
Posts: 196
the wrong place
|
where do you use those keys. can you show it?
Come and play my new browsergame - Valley Of Wolves: http://www.mafiacreator.com/ValleyOfWolvesHurry and be the first to take over the different business' in the Valley Of Wolves, before anybody else does it! And be the most feared MafiaBoss in the World!!
|
|
|
Re: HOW TO STOP KEY
[Re: Muhsin]
#324047
05/19/10 09:44
05/19/10 09:44
|
Joined: Nov 2008
Posts: 196 the wrong place
Muhsin
Member
|
Member
Joined: Nov 2008
Posts: 196
the wrong place
|
you could do like this: ----------------------------------------- var car_car = 0;
if(car_car == 0) {
if(key_z) { //you code, when you click z } if(key_a) { //you code, when you click a } if(key_d) { //you code, when you click d } if(key_s) { //you code, when you click s }
} -----------------------------------
- Muhsin Kaymak
Come and play my new browsergame - Valley Of Wolves: http://www.mafiacreator.com/ValleyOfWolvesHurry and be the first to take over the different business' in the Valley Of Wolves, before anybody else does it! And be the most feared MafiaBoss in the World!!
|
|
|
Re: HOW TO STOP KEY
[Re: cgcg]
#324050
05/19/10 10:21
05/19/10 10:21
|
Joined: Jul 2008
Posts: 1,178 England
MrGuest
Serious User
|
Serious User
Joined: Jul 2008
Posts: 1,178
England
|
if that function is running in a while loop, you'd be better off terminating the function that's using if(key_w) etc... have a look in the manual at proc_kill(void) posting when someone has asked where do you use those keys. can you show it? isn't really useful 
|
|
|
Re: HOW TO STOP KEY
[Re: cgcg]
#324051
05/19/10 10:22
05/19/10 10:22
|
Joined: May 2010
Posts: 117 Germany , Dortmund
Bone
Member
|
Member
Joined: May 2010
Posts: 117
Germany , Dortmund
|
With if you can check which key the person press or which key (or keys) are not pressed
var key_s_counter = 0;
if(key_s && !key_w) // if key_s is true (key_s == 1) & key_w is false (key_w == 0)
key_s_counter +=1;
I dont know what you want to do. Please write more about your problem.
|
|
|
Re: HOW TO STOP KEY
[Re: Bone]
#324069
05/19/10 12:54
05/19/10 12:54
|
Joined: Apr 2005
Posts: 1,988 Canadian, Eh
DLively
Serious User
|
Serious User
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
|
basically; reverse your code. instead of this
if (car_car==1)
{
key_z=off;
key_a=off;
key_d=off;
key_s=off;
}
cause with this , the engine can't terminate the keys that simply. you need to tell the engine that while car_car is 0, the keys are function-able.
//if its not 0, the engine will pass it, and fly right through to next if / code
if (car_car==0)//while the variable is 0, you can set up these keys to work
{
if(key_z)
{
//you code, when you click z
}
if(key_a)
{
//you code, when you click a
}
if(key_d)
{
//you code, when you click d
}
if(key_s)
{
//you code, when you click s
}
}
Muhsin answered your question a long time ago - just not very clearly.
|
|
|
Re: HOW TO STOP KEY
[Re: cgcg]
#324075
05/19/10 13:15
05/19/10 13:15
|
Joined: Jan 2002
Posts: 4,225 Germany / Essen
Uhrwerk
Expert
|
Expert
Joined: Jan 2002
Posts: 4,225
Germany / Essen
|
YOU CANT STOP THE BUTTON WORKS. READ A TUTORIAL. SERIOUSLY.
Always learn from history, to be sure you make the same mistakes again...
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|