Have questions about CoD4 mapping that aren't covered in the tutorials section? Post here!
Moderator: Core Staff
-
Goro92
- CJ Spammer!
- Posts: 605
- Joined: March 7th, 2011, 5:54 pm
- Location: Brescia, Italy
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.
-
iCYsoldier
- CJ Worshipper
- Posts: 289
- Joined: December 5th, 2009, 7:12 am
- Location: Australia
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
-
Goro92
- CJ Spammer!
- Posts: 605
- Joined: March 7th, 2011, 5:54 pm
- Location: Brescia, Italy
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
-
IzNoGoD
- CJ Worshipper
- Posts: 343
- Joined: January 6th, 2009, 8:39 pm
- Location: Netherlands/Holland
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!
-
Goro92
- CJ Spammer!
- Posts: 605
- Joined: March 7th, 2011, 5:54 pm
- Location: Brescia, Italy
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
-
IzNoGoD
- CJ Worshipper
- Posts: 343
- Joined: January 6th, 2009, 8:39 pm
- Location: Netherlands/Holland
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!
-
Goro92
- CJ Spammer!
- Posts: 605
- Joined: March 7th, 2011, 5:54 pm
- Location: Brescia, Italy
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!
THANKS!
Users browsing this forum: No registered users and 34 guests