Duel's (Including sessions)

Posted by KadePcGames
So I'm trying to make a duel concept in my game
so first we have 2 objects
obj_duels
obj_player
The error i'm getting is that it's just not working!
obj_duels code:
coli with obj_player:
if gms_global_get("duel") = "" {
ask = get_string("Would you like to duel someone? (y,n)","")
if ask = "y" {
user = get_string("Who?","")
usera = gms_other_find_by_name(user)
userf = gms_other_get_string(usera, "name")
userd = gms_other_find_by_name(gms_self_name())
usere = gms_other_get_string(userd, "name")
if userf = "" {
show_message("Error! That user is not online!");
} else {
gms_global_set("duel",string(userf));
gms_global_set("duelreq",string(usere));
show_message("Sent to " + userf + "!");
alarm[0] = 300;
}
} else {
show_message("Returning");
}
} else {
show_message("You Cannot Duel At This Moment!");
}

Alarm 0:
show_message("They have not accepted your duel!")
gms_global_set("duel","");

The player code is the pastebin:https://pastebin.com/tRK5u7zC

Replies (3)

Last message on 6 Apr 2018

AouabAdYT on 6 Apr 2018, 19:08:24
By the way ,

Instead of
get_string("Would you like to duel someone? (y,n)","")
and then checking either it's 'y' or 'n'

You can simply
show_question("Would you like to duel someone? (y,n)")


It shows two buttons "Yes" and "No"
It returns true if the player answers "Yes" and false if "No".
Size43 (Administrator) on 28 Mar 2018, 19:22:29
You're missing some brackets around 'gms_self_name' on line 30 (of your pastebin).

Also, you might want to check out P2P messages. They're made for this kind of back-and-forth between two clients.
KadePcGames (Topicstarter) on 27 Mar 2018, 06:14:20
The error is basicly on telling the player to join the new session