Help (KEY_YES)
#1

Hello, i dont know how to add (KEY_YES) option to this , so i want to let /enter working & add "y" button to enter..
Код HTML:
	if(strcmp(cmd, "/enter", true) == 0)
	{
		if(PlayerTied[playerid] != 0 || PlayerCuffed[playerid] != 0 || PlayerJustDied[playerid] != 0) return SendClientMessage(playerid, COLOR_GRAD1, " You are unable to do that at this time.");
		for(new i = 0;i < sizeof(EntranceRef);i++)
		{
			if(
				IsPlayerInRangeOfPoint(playerid,2,Entrances[i][outside_x],Entrances[i][outside_y],Entrances[i][outside_z]) &&
				GetPlayerVirtualWorld(playerid) == Entrances[i][outside_w] &&
				GetPlayerInterior(playerid) == Entrances[i][outside_i])
			{
			    if(strlen(Entrances[i][dpassword])) // has a pass
				{
				    ShowPlayerDialog(	playerid,
										DIALOG_ID_PLAYER_PASS,
										DIALOG_STYLE_INPUT,
										"Door Password",
										"Please enter the door's password to enter.",
										"Okay",
										"Cancel");
					return 1;
				}
				if(Entrances[i][dfaction] == 0)
				{
				    SetPlayerPos(playerid,Entrances[i][inside_x],Entrances[i][inside_y],Entrances[i][inside_z]);
					SetPlayerFacingAngle(playerid,Entrances[i][inside_a]);
					SetPlayerInterior(playerid,Entrances[i][inside_i]);
					SetPlayerVirtualWorld(playerid,Entrances[i][inside_w]);
					SetCameraBehindPlayer(playerid);
					if(Entrances[i][freeze])
					{
				    	FreezePlayer(playerid, FREEZE, ENTER_FREEZE);
					}
				}
sorry for my bad english
Reply
#2

Put this at your #defines section
PHP код:
#define PRESSING(%0,%1) \
    
(%& (%1))
#define PRESSED(%0) \
    
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0))) 
Now add this to OnPlayerKetStateChange
PHP код:
    if(PRESSED(KEY_YES))
    {
        if(
PlayerTied[playerid] != || PlayerCuffed[playerid] != || PlayerJustDied[playerid] != 0) return SendClientMessage(playeridCOLOR_GRAD1" You are unable to do that at this time.");
        for(new 
0;sizeof(EntranceRef);i++)
        {
            if(
                
IsPlayerInRangeOfPoint(playerid,2,Entrances[i][outside_x],Entrances[i][outside_y],Entrances[i][outside_z]) &&
                
GetPlayerVirtualWorld(playerid) == Entrances[i][outside_w] &&
                
GetPlayerInterior(playerid) == Entrances[i][outside_i])
            {
                if(
strlen(Entrances[i][dpassword])) // has a pass
                
{
                    
ShowPlayerDialog(    playerid,
                                        
DIALOG_ID_PLAYER_PASS,
                                        
DIALOG_STYLE_INPUT,
                                        
"Door Password",
                                        
"Please enter the door's password to enter.",
                                        
"Okay",
                                        
"Cancel");
                    return 
1;
                }
                if(
Entrances[i][dfaction] == 0)
                {
                    
SetPlayerPos(playerid,Entrances[i][inside_x],Entrances[i][inside_y],Entrances[i][inside_z]);
                    
SetPlayerFacingAngle(playerid,Entrances[i][inside_a]);
                    
SetPlayerInterior(playerid,Entrances[i][inside_i]);
                    
SetPlayerVirtualWorld(playerid,Entrances[i][inside_w]);
                    
SetCameraBehindPlayer(playerid);
                    if(
Entrances[i][freeze])
                    {
                        
FreezePlayer(playeridFREEZEENTER_FREEZE);
                    }
                }
            }
        }
    } 
Reply
#3

Quote:
Originally Posted by aoky
Посмотреть сообщение
Put this at your #defines section
PHP код:
#define PRESSING(%0,%1) \
    
(%& (%1))
#define PRESSED(%0) \
    
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0))) 
Now add this to OnPlayerKetStateChange
PHP код:
    if(PRESSED(KEY_YES))
    {
        if(
PlayerTied[playerid] != || PlayerCuffed[playerid] != || PlayerJustDied[playerid] != 0) return SendClientMessage(playeridCOLOR_GRAD1" You are unable to do that at this time.");
        for(new 
0;sizeof(EntranceRef);i++)
        {
            if(
                
IsPlayerInRangeOfPoint(playerid,2,Entrances[i][outside_x],Entrances[i][outside_y],Entrances[i][outside_z]) &&
                
GetPlayerVirtualWorld(playerid) == Entrances[i][outside_w] &&
                
GetPlayerInterior(playerid) == Entrances[i][outside_i])
            {
                if(
strlen(Entrances[i][dpassword])) // has a pass
                
{
                    
ShowPlayerDialog(    playerid,......................... 
Thanks Thanks
but i still want if(strcmp(cmd, "/enter", true) == 0)
how to make them both
Reply
#4

What about this?
PHP код:
    ShowEnter(playerid)
    {
        if(
PlayerTied[playerid] != || PlayerCuffed[playerid] != || PlayerJustDied[playerid] != 0) return SendClientMessage(playeridCOLOR_GRAD1" You are unable to do that at this time.");
        for(new 
0;sizeof(EntranceRef);i++)
        {
            if(
                
IsPlayerInRangeOfPoint(playerid,2,Entrances[i][outside_x],Entrances[i][outside_y],Entrances[i][outside_z]) &&
                
GetPlayerVirtualWorld(playerid) == Entrances[i][outside_w] &&
                
GetPlayerInterior(playerid) == Entrances[i][outside_i])
            {
                if(
strlen(Entrances[i][dpassword])) // has a pass
                
{
                    
ShowPlayerDialog(    playerid,
                                        
DIALOG_ID_PLAYER_PASS,
                                        
DIALOG_STYLE_INPUT,
                                        
"Door Password",
                                        
"Please enter the door's password to enter.",
                                        
"Okay",
                                        
"Cancel");
                    return 
1;
                }
                if(
Entrances[i][dfaction] == 0)
                {
                    
SetPlayerPos(playerid,Entrances[i][inside_x],Entrances[i][inside_y],Entrances[i][inside_z]);
                    
SetPlayerFacingAngle(playerid,Entrances[i][inside_a]);
                    
SetPlayerInterior(playerid,Entrances[i][inside_i]);
                    
SetPlayerVirtualWorld(playerid,Entrances[i][inside_w]);
                    
SetCameraBehindPlayer(playerid);
                    if(
Entrances[i][freeze])
                    {
                        
FreezePlayer(playeridFREEZEENTER_FREEZE);
                    }
                }
            }
        }
    } 
And you can use it anywhere, inside OnPlayerKeyState and OnPlayerCommandText.
PS: Get YCMD because is easyer to do commands with it...
Reply
#5

Quote:
Originally Posted by aoky
Посмотреть сообщение
Put this at your #defines section
PHP код:
#define PRESSING(%0,%1) \
    
(%& (%1))
#define PRESSED(%0) \
    
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0))) 
Now add this to OnPlayerKetStateChange
PHP код:
    if(PRESSED(KEY_YES))
    {
        if(
PlayerTied[playerid] != || PlayerCuffed[playerid] != || PlayerJustDied[playerid] != 0) return SendClientMessage(playeridCOLOR_GRAD1" You are unable to do that at this time.");
        for(new 
0;sizeof(EntranceRef);i++)
        {
            if(
                
IsPlayerInRangeOfPoint(playerid,2,Entrances[i][outside_x],Entrances[i][outside_y],Entrances[i][outside_z]) &&
                
GetPlayerVirtualWorld(playerid) == Entrances[i][outside_w] &&
                
GetPlayerInterior(playerid) == Entrances[i][outside_i])
            {
                if(
strlen(Entrances[i][dpassword])) // has a pass
                
{
                    
ShowPlayerDialog(    playerid,
                                        
DIALOG_ID_PLAYER_PASS,
                                        
DIALOG_STYLE_INPUT,
                                        
"Door Password",
                                        
"Please enter the door's password to enter.",
                                        
"Okay",
                                        
"Cancel");
                    return 
1;
                }
                if(
Entrances[i][dfaction] == 0)
                {
                    
SetPlayerPos(playerid,Entrances[i][inside_x],Entrances[i][inside_y],Entrances[i][inside_z]);
                    
SetPlayerFacingAngle(playerid,Entrances[i][inside_a]);
                    
SetPlayerInterior(playerid,Entrances[i][inside_i]);
                    
SetPlayerVirtualWorld(playerid,Entrances[i][inside_w]);
                    
SetCameraBehindPlayer(playerid);
                    if(
Entrances[i][freeze])
                    {
                        
FreezePlayer(playeridFREEZEENTER_FREEZE);
                    }
                }
            }
        }
    } 
errors :

C:\Users\FBF\Desktop\MGRP\pawno\include\mSelection .inc(69 : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\FBF\Desktop\SA-MP SCRIPTING\MGRP - Copy.pwn(341) : warning 201: redefinition of constant/macro (symbol "PRESSED(%0)")
C:\Users\X\Desktop\SA-MP SCRIPTING\X - Copy.pwn(12470) : error 029: invalid expression, assumed zero
C:\Users\X\Desktop\SA-MP SCRIPTING\X - Copy.pwn(12470) : warning 215: expression has no effect
C:\Users\X\Desktop\SA-MP SCRIPTING\X - Copy.pwn(12470) : error 001: expected token: ";", but found ")"
C:\Users\X\Desktop\SA-MP SCRIPTING\X - Copy.pwn(12470) : error 029: invalid expression, assumed zero
C:\Users\X\Desktop\SA-MP SCRIPTING\X - Copy.pwn(12470) : fatal error 107: too many error messages on one line
Reply
#6

Remove this:
PHP код:
#define PRESSING(%0,%1) \ 
    
(%& (%1)) 
#define PRESSED(%0) \ 
    
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0))) 
Can you show the lines the errors are on?
Reply
#7

Quote:
Originally Posted by aoky
Посмотреть сообщение
Remove this:
PHP код:
#define PRESSING(%0,%1) \ 
    
(%& (%1)) 
#define PRESSED(%0) \ 
    
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0))) 
Can you show the lines the errors are on?
i deleted them , the error now :

(49037) : error 017: undefined symbol "newkeys"


the line :


here is the line >>> if(PRESSED(KEY_YES)) <<<<<
{
if(PlayerTied[playerid] != 0 || PlayerCuffed[playerid] != 0 || PlayerJustDied[playerid] != 0) return SendClientMessage(playerid, COLOR_GRAD1, " You are unable to do that at this time.");
for(new i = 0;i < sizeof(EntranceRef);i++)
Reply
#8

im laughing badly sadly

you didn't take his notes, you wrote that in OnPlayercommandtext or W/e that bs is

if you look at what he actually said and not just copy + c and copy +v, he said put it under OnPlayerKeyStateChange
Reply
#9

Quote:
Originally Posted by Meller
Посмотреть сообщение
im laughing badly sadly

you didn't take his notes, you wrote that in OnPlayercommandtext or W/e that bs is

if you look at what he actually said and not just copy + c and copy +v, he said put it under OnPlayerKeyStateChange
ok, you was also a newbie.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)