SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 02/08/2020, 12:19 PM   #1
Rannie
Little Clucker
 
Join Date: Jul 2020
Posts: 6
Reputation: 0
Default Pressing Y to Enter

Hello.Im just new in scripting.I want the (/enter)(/exit) in Y key.I dont know what to add in "//code here"
Can someone help me?This is my strcmp code.I found codes in other threads but its in zcmd

This is the code that i found
Code:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(PRESSED(KEY_YES))
    {
        // Code here
    }
	return 1;
}
And this is the code in CGRP gm
Code:
if(strcmp(cmd, "/enter", true) == 0)
This is the whole code for /enter
https://pastebin.com/xHk7ukJj
Rannie is online now   Reply With Quote
Old 02/08/2020, 12:35 PM   #2
xRadical3
Gangsta
 
Join Date: May 2017
Location: Iran
Posts: 638
Reputation: 47
Default Re: Pressing Y to Enter

pawn Code:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(PRESSED(KEY_YES))
    {
        OnPlayerCommandText(playerid, "/enter");
    }
    return 1;
}
xRadical3 is online now   Reply With Quote
Old 02/08/2020, 01:12 PM   #3
Rannie
Little Clucker
 
Join Date: Jul 2020
Posts: 6
Reputation: 0
Default Re: Pressing Y to Enter

How about /exit?
+rep
Rannie is online now   Reply With Quote
Old 02/08/2020, 01:14 PM   #4
Rannie
Little Clucker
 
Join Date: Jul 2020
Posts: 6
Reputation: 0
Default Re: Pressing Y to Enter

Else?

if(PRESSED(KEY_YES))
{
OnPlayerCommandText(playerid, "/enter");
}
else
{
OnPlayerCommandText(playerid, "/exit");
}
return 1;

is this right?
Rannie is online now   Reply With Quote
Old 02/08/2020, 01:37 PM   #5
xRadical3
Gangsta
 
Join Date: May 2017
Location: Iran
Posts: 638
Reputation: 47
Default Re: Pressing Y to Enter

Quote:
Originally Posted by Rannie View Post
Else?

if(PRESSED(KEY_YES))
{
OnPlayerCommandText(playerid, "/enter");
}
else
{
OnPlayerCommandText(playerid, "/exit");
}
return 1;

is this right?

Yeah.
xRadical3 is online now   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Enter the interior by pressing ENTER k2bi Scripting Help 1 21/01/2018 06:35 AM
HOW TO ENTER BUILDING WITH PRESSING KEY ? [HELP] jetpas Scripting Help 1 09/06/2016 03:18 AM
Pressing a key to enter/exit building Lucky™ Scripting Help 8 05/02/2015 01:07 PM
how to enter the building or door by pressing the enter key kurniarocki Scripting Help 6 08/04/2014 05:43 AM


All times are GMT. The time now is 03:52 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.