Hotkeys IN-Game -
Vinninho - 07.02.2013
Hello everyone, I want an hotkey "f" which will make the user say: /enter or /exit.
Something like this:
http://forum.sa-mp.com/showthread.ph...ghlight=hotkey
But I'm not sure how to start this is where I get:
Code:
public OnPlayerKeyStateChange( playerid, newkeys, oldkeys )
{
if( newkeys & KEY_SECONDARY_ATTACK )
{
NOT SURE WHAT TO ADD HERE!
}
return 1;
}
Re: Hotkeys IN-Game -
Scenario - 07.02.2013
Several different options here. I'll give you a quick example though...
pawn Code:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys & KEY_SECONDARY_ATTACK)
{
if(IsPlayerInRangeOfPoint(playerid, 7.0, X, Y, Z))
{
SetPlayerPos(playerid, X, Y, Z);
SetPlayerInterior(playerid, INTERIOR);
}
else if(IsPlayerInRangeOfPoint(playerid, 7.0, X, Y, Z))
{
SetPlayerPos(playerid, X, Y, Z);
SetPlayerInterior(playerid, INTERIOR);
}
}
return 1;
}
Re: Hotkeys IN-Game -
Vinninho - 07.02.2013
Quote:
Originally Posted by RealCop228
Several different options here. I'll give you a quick example though...
pawn Code:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if(newkeys & KEY_SECONDARY_ATTACK) { if(IsPlayerInRangeOfPoint(playerid, 7.0, X, Y, Z)) { SetPlayerPos(playerid, X, Y, Z); SetPlayerInterior(playerid, INTERIOR); } else if(IsPlayerInRangeOfPoint(playerid, 7.0, X, Y, Z)) { SetPlayerPos(playerid, X, Y, Z); SetPlayerInterior(playerid, INTERIOR); } } return 1; }
|
I appreciate ur help, but it still gives me some errors:
Code:
C:\Users\Vinay\Downloads\megag.pwn(13965) : error 017: undefined symbol "X"
C:\Users\Vinay\Downloads\megag.pwn(13967) : error 017: undefined symbol "X"
C:\Users\Vinay\Downloads\megag.pwn(13968) : error 017: undefined symbol "INTERIOR"
C:\Users\Vinay\Downloads\megag.pwn(13970) : error 017: undefined symbol "X"
C:\Users\Vinay\Downloads\megag.pwn(13972) : error 017: undefined symbol "X"
C:\Users\Vinay\Downloads\megag.pwn(13973) : error 017: undefined symbol "INTERIOR"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
6 Errors.
Lines:
Code:
if(newkeys & KEY_SECONDARY_ATTACK)
{
if(IsPlayerInRangeOfPoint(playerid, 7.0, X, Y, Z))
{
SetPlayerPos(playerid, X, Y, Z);
SetPlayerInterior(playerid, INTERIOR);
}
else if(IsPlayerInRangeOfPoint(playerid, 7.0, X, Y, Z))
{
SetPlayerPos(playerid, X, Y, Z);
SetPlayerInterior(playerid, INTERIOR);
}
Re: Hotkeys IN-Game -
Scrillex - 07.02.2013
X, Y, Z)
It's your possitions where the need to be.. You need to replace them!
Re: Hotkeys IN-Game -
Vinninho - 07.02.2013
Quote:
Originally Posted by Scrillex
X, Y, Z)
It's your possitions where the need to be.. You need to replace them!
|
No, no! You don't get it. It shouldn't only work at one specific location.
I want it to automaticlly do /enter or /exit before a dynamic door/business/house etc. ! No matter the coordinates
Re: Hotkeys IN-Game -
Scenario - 07.02.2013
Are you using ZCMD for commands?
Also, do you already have both /enter and /exit commands scripted?
Re: Hotkeys IN-Game -
Vinninho - 07.02.2013
Quote:
Originally Posted by RealCop228
Are you using ZCMD for commands?
Also, do you already have both /enter and /exit commands scripted?
|
Yeah, I use ZCMD. And yes, I got them both scripted!
Re: Hotkeys IN-Game -
Scenario - 07.02.2013
pawn Code:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys & KEY_SECONDARY_ATTACK)
{
if(EnteredInterior[playerid]) return cmd_exit(playerid, "");
else return cmd_enter(playerid, "");
}
return 1;
}
The above code will basically call /enter or /exit depending on the validity of this bool statement:
pawn Code:
EnteredInterior[playerid]
You will want to make this a true statement in your /enter command, so towards the bottom or something, do this:
pawn Code:
EnteredInterior[playerid] = true;
... and you'll want to make this a false statement in your /exit command, so towards the bottom or something, add this:
pawn Code:
EnteredInterior[playerid] = false;
Don't forget to add this at the top of your script...
pawn Code:
new bool:EnteredInterior[MAX_PLAYERS] = false;
Re: Hotkeys IN-Game -
Vinninho - 07.02.2013
Quote:
Originally Posted by RealCop228
pawn Code:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if(newkeys & KEY_SECONDARY_ATTACK) { if(EnteredInterior[playerid]) return cmd_exit(playerid, ""); else return cmd_enter(playerid, ""); } return 1; }
The above code will basically call /enter or /exit depending on the validity of this bool statement:
pawn Code:
EnteredInterior[playerid]
You will want to make this a true statement in your /enter command, so towards the bottom or something, do this:
pawn Code:
EnteredInterior[playerid] = true;
... and you'll want to make this a false statement in your /exit command, so towards the bottom or something, add this:
pawn Code:
EnteredInterior[playerid] = false;
Don't forget to add this at the top of your script...
pawn Code:
new bool:EnteredInterior[MAX_PLAYERS] = false;
|
Appreciate it, testing it now!
Re: Hotkeys IN-Game -
Vinninho - 07.02.2013
It worked! Thank you so F*cking much!!!! I love you!