Add Cookie.IsSet()

This commit is contained in:
Alienmario 2024-11-10 12:52:49 +01:00 committed by GitHub
parent a16ba7ca7b
commit d5bf3159ec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -157,7 +157,6 @@ methodmap Cookie < Handle {
this.Set(client, sValue); this.Set(client, sValue);
} }
// Retrieve the value of a Client preference cookie. // Retrieve the value of a Client preference cookie.
// //
// @param client Client index. // @param client Client index.
@ -202,6 +201,16 @@ methodmap Cookie < Handle {
return value; return value;
} }
// Checks whether a Client preference cookie has been set (is not an empty string).
//
// @param client Client index.
// @error Invalid cookie handle or invalid client index.
public bool IsSet(int client) {
char buffer[2];
this.Get(client, buffer, sizeof(buffer));
return buffer[0] != '\0';
}
// Set the value of a Client preference cookie based on an authID string. // Set the value of a Client preference cookie based on an authID string.
// //
// @param authID String Auth/STEAM ID of player to set. // @param authID String Auth/STEAM ID of player to set.