Garry's Mod

Garry's Mod

Not enough ratings
E2 Cookies Extension
   
Award
Favorite
Favorited
Unfavorite
Content Type: Addon
Addon Type: ServerContent
Addon Tags: Fun, Realism
File Size
Posted
Updated
2.299 KB
29 Oct, 2016 @ 12:08pm
5 Nov, 2016 @ 7:07am
8 Change Notes ( view )

Subscribe to download
E2 Cookies Extension

In 3 collections by SammyT291
FineTree Pack 1
74 items
BlueArrow Rail Server Addons
167 items
FineBuild - Server Side
68 items
Description
E2 Cookies
Allows E2 chips to Set and Get cookies (saved info) from the server / client / friends clients

##############
Server Functions
##############

getCookie( S )
Returns the value of your cookie S from the server

setCookie( S, S2 )
Sets the value of your cookie S on the server to S2

deleteCookie( S )
Deletes your cookie S from the server

#############
Client Functions
#############

getClientCookie( S )
Requests the cookie S to be sent from your client
See the notes section below on how to return client cookies!

setClientCookie( S, S2 )
Sends the value S2 to be saved to the cookie S on your client

deleteClientCookie( S )
Requests the cookie S to be deleted from your client

####################
Client 2 Client Functions
####################

getClientCookie( E, S )
Requests the cookie S to be sent from E's client
See the notes section below on how to return client cookies!

setClientCookie( E, S, S2 )
Sends the value S2 to be saved to the cookie S on E's client

deleteClientCookie( E, S )
Requests the cookie S to be deleted from E's client

#############
Other Functions
#############

runOnCookie( N )
if N is not 0 then the expression will execute upon the server recieving a client Cookie

cookieClk()
Return 1 if the expression was executed by the server receiving a client cookie, other wise returns 0

cookieClk( E )
Return 1 if the expression was executed by the server receiving a client cookie from player E, otherwise returns 0

cookieKey()
Returns the last client cookie the server received

cookieValue()
Returns the last data the server received from a client cookie

cookieError()
Returns the last error encountered by the extension

cookieErrorChip()
Returns the last expression that caused an error

canCookie( S )
Returns 1 if you can Set/Get/Delete a cookie of type S, otherwise returns 0
Types can be: "sv" for server "cl" for client and "cross" for client 2 client

remainingCookie( S )
Returns how many Set/Get/Deletes you can use currently of type S
Types can be: "sv" for server "cl" for client and "cross" for client 2 client

#####
Notes
#####

1. Returning a client cookie example:
if(first()){
T = findPlayerByName( "ARandomName" )
getClientCookie( T )
}

runOnCookie(1)

if(cookieClk()){
print( cookieKey() + " had the following data:" )
print( cookieValue() )
}

2. In order to Set/Get/Delete a cookie on someone elses client you need to have their prop protection.

3. In order to return cookieKey() or cookieValue() you must have the Prop Protection of the player the data came from.

#############
Server ConVars
#############

e2_cookies_cl_mode
Sets if client functions should be allowed for everyone (0), admins (1) or superAdmins (2) only
Default is 0

e2_cookies_sv_mode
Sets if server functions should be allowed for everyone (0), admins (1) or superAdmins (2) only
Default is 0

e2_cookies_cross_mode
Sets if client 2 client functions should be allowed for everyone (0), admins (1) or superAdmins (2) only
Default is 1

e2_cookies_clear_time
How long in seconds until reseting the rate limit values
Can be decimal such as 2.5 seconds
default is 2.0

e2_cookies_cl_rate
How many client function requests to allow per time set above
Default is 4

e2_cookies_sv_rate
How many server function requests to allow per time set above
Default is 8

e2_cookies_cross_rate
How many client 2 client function requests to allow per time set above
Default is 2