keypad help [SOLVED]

Have questions about CoD4 mapping that aren't covered in the tutorials section? Post here!

Moderator: Core Staff

Post Reply
User avatar
Goro92
CJ Spammer!
CJ Spammer!
Posts: 605
Joined: March 7th, 2011, 5:54 pm
Location: Brescia, Italy

keypad help [SOLVED]

Post by Goro92 » August 23rd, 2011, 10:04 am

i made a working keypad but i want to add a button that delete the last number added..
i make an example because of my english....if i put this code 12345663--->hit the CancKey--->the code now is 1234566


i tried this but not work

Code: Select all

 
main()
{
....
 
thread ButtonCANC();
level.scritta = ""; 
}
 
.....
ButtonCANC()
{
buttonCANC = getent("buttonCANC","targetname");
while(1)
{
buttonCANC waittill ("trigger", user);
level.scritta = level.scritta - " ";
user iprintln(level.scritta);
wait .5;
}
} 
 
Last edited by Goro92 on August 23rd, 2011, 1:26 pm, edited 1 time in total.
Image

User avatar
iCYsoldier
CJ Worshipper
CJ Worshipper
Posts: 289
Joined: December 5th, 2009, 7:12 am
Location: Australia

Re: keypad help

Post by iCYsoldier » August 23rd, 2011, 10:51 am

Maybe try: create a temp string; set it to the users code without the last char by looping through the string; set the current code to the temp string

There might be a more efficient way of doing this, but I just thought of this

User avatar
Goro92
CJ Spammer!
CJ Spammer!
Posts: 605
Joined: March 7th, 2011, 5:54 pm
Location: Brescia, Italy

Re: keypad help

Post by Goro92 » August 23rd, 2011, 10:55 am

iCYsoldier wrote:Maybe try: create a temp string; set it to the users code without the last char by looping through the string; set the current code to the temp string

There might be a more efficient way of doing this, but I just thought of this
wait wait wait...i'm not so pro in script XD

how to create a temp string?

thx for help
Image

IzNoGoD
CJ Worshipper
CJ Worshipper
Posts: 343
Joined: January 6th, 2009, 8:39 pm
Location: Netherlands/Holland

Re: keypad help

Post by IzNoGoD » August 23rd, 2011, 11:43 am

Code: Select all

if(level.scritta.size>0)
level.scritta = getsubstr(level.scritta,0,level.scritta.size);
LMGTFY!

Its not a glitch... Its the future!

User avatar
Goro92
CJ Spammer!
CJ Spammer!
Posts: 605
Joined: March 7th, 2011, 5:54 pm
Location: Brescia, Italy

Re: keypad help

Post by Goro92 » August 23rd, 2011, 12:45 pm

IzNoGoD wrote:

Code: Select all

if(level.scritta.size>0)
level.scritta = getsubstr(level.scritta,0,level.scritta.size);

Code: Select all

main()

{

....

thread ButtonCANC();

level.scritta = "";

}

 

.....

ButtonCANC()

{

buttonCANC = getent("buttonCANC","targetname");

while(1)

{

buttonCANC waittill ("trigger", user);

if(level.scritta.size>0){
level.scritta = getsubstr(level.scritta,0,level.scritta.size);

}

user iprintln(level.scritta);

wait .5;

}

} 

there is no error but does not work...just repeat the code without delete the last number added..
maybe there is something that i need to add in the main?

btw thx for ur help
Image

IzNoGoD
CJ Worshipper
CJ Worshipper
Posts: 343
Joined: January 6th, 2009, 8:39 pm
Location: Netherlands/Holland

Re: keypad help

Post by IzNoGoD » August 23rd, 2011, 1:10 pm

Damn, i must have been sleeping somehow
getsubstr(level.scritta,0,level.scritta.size-1) ofc
LMGTFY!

Its not a glitch... Its the future!

User avatar
Goro92
CJ Spammer!
CJ Spammer!
Posts: 605
Joined: March 7th, 2011, 5:54 pm
Location: Brescia, Italy

Re: keypad help [SOLVED]

Post by Goro92 » August 23rd, 2011, 1:25 pm

IzNoGoD wrote:Damn, i must have been sleeping somehow
getsubstr(level.scritta,0,level.scritta.size-1) ofc

PERFECT! :mrgreen:

THANKS!
Image

Post Reply

Who is online

Users browsing this forum: No registered users and 34 guests