Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'avarianknight/feat/player-exists'
- Loading branch information
Showing
3 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
ns: CFX | ||
apiset: server | ||
--- | ||
## DOES_PLAYER_EXIST | ||
|
||
```c | ||
BOOL DOES_PLAYER_EXIST(char* playerSrc); | ||
``` | ||
Returns whether or not the player exists | ||
## Return value | ||
True of the player exists, false otherwise | ||
## Examples | ||
```lua | ||
local deferralMessages = { "Isn't this just magical!", "We can defer all day!", "You'll get in eventually", "You're totally not going to sit here forever", "The Fruit Tree is a lie" } | ||
AddEventHandler("playerConnecting", function(name, setKickReason, deferrals) | ||
local source = source | ||
deferrals.defer() | ||
Wait(0) | ||
local messageIndex = 0 | ||
repeat | ||
Wait(2000) | ||
if messageIndex >= #deferralMessages then | ||
deferrals.done() | ||
else | ||
messageIndex = messageIndex + 1 | ||
end | ||
deferrals.update(deferralMessages[messageIndex]) | ||
until not DoesPlayerExist(source) | ||
end) | ||
``` |