Duui YT Did you add the rest to onPlayerSpawned()
?
TheHiddenHour
Posts
-
Respawn on Saved Position Code? -
[Resource] Stat Modification, Checks, Other Structures..Nice thread, I wasn't aware of some of these structs.
-
How can I find out the number of players on a team?There's probably a built in function to do it but you can write a simple one like this.
getTeamCount(team) { count = 0; foreach(player in level.players) { if(player.team == team) { count++; } } return count; }
-
[Release] GSC Dump SearcherGSC Dump Search
This program will search the contents of every GSC file in the defined directory for a specified string and return its usage, path, and line. It is also able to show the origin script with syntax highlighting by double clicking the location cell of the search results.
Photos
Main Form
GSC Peek Form
Notes
You must provide your own decompiled GSC dump. The program looks for a folder named
gsc-dump
at the root of the program directory and can be changed inconfig.json
.All of the toolbar functionality is also missing at the moment.
Downloads
GitHub Source
GitHub Releases
Full GSC Dump (SP, MP, & ZM scripts)
Trimmed GSC Dump (Only MP & ZM scripts)I did not make these dumps. I came to possess them long ago from people on other forums.
-
Respawn on Saved Position Code?Duui YT If you commission me to write it, test it, and ensure that you incorporate it into your project properly then yeah lmao.
Here's a simple example that should get you started if you know how to script
init() { level thread onPlayerConnect(); } onPlayerConnect() { level waittill("connected", player); player thread onPlayerSpawned(); } onPlayerSpawned() { self endon("disconnect"); for(;;) { self waittill("spawned_player"); if(isDefined(self.savedOrigin) && isDefined(self.savedAngles)) { self moveToSavedLocation(); } } } // Set saved location saveLocation() { self.savedOrigin = self.origin; self.savedAngles = self.angles; self iprintln("^1Saved location"); } // Move entity to saved location moveToSavedLocation() { self setOrigin(self.savedOrigin); self.angles = self.savedAngles; // Can't remember if there's a function to set an entity's angles self iprintln("^1Moved to saved location"); } // Erase saved location to prevent spawning on it eraseSavedLocation() { self.savedOrigin = undefined; self.savedAngles = undefined; self iprintln("^1Saved location erased"); }
-
Should I work on a new GSC editor?Ducxy said in Should I work on a new GSC editor?:
monaco editor
I'd actually like to see something more akin to a VS Code plugin rather than an entirely new editor. It'd allow me to continue using my VS Code settings and would probably have a smaller footprint as well .
-
Respawn on Saved Position Code?Vulgar Put this in
onPlayerSpawned()
after thewaittill
if(isDefined(self.savedOrigin) && isDefined(self.savedAngles)) { self setPlayerAngles(self.savedAngles); self setOrigin(self.savedOrigin); }
-
Respawn on Saved Position Code?toggleSaveAndLoad() { if(!isDefined(self.saveAndLoad) || !self.saveAndLoad) { self.saveAndLoad = true; self thread saveAndLoad(); } else { self.saveAndLoad = false; self notify("endSaveAndLoad"); } msg = "Save and Load [" + (self.saveAndLoad) ? "^2ON" : "^1OFF" + "^7]"; self iprintln(msg); } saveAndLoad() { self endon("disconnect"); self endon("endSaveAndLoad") for(;;) { if(self getStance() == "crouch") { if(self actionSlotTwoButtonPressed()) { // Save location self.savedOrigin = self.origin; self.savedAngles = self.angles; self iprintln("^5Position saved"); } else if(self actionSlotOneButtonPressed()) { // Load location self setPlayerAngles(self.savedAngles); self setOrigin(self.savedOrigin); self iprintln("^6Position loaded"); } } wait .01; } }
Untested.
-
Respawn on Saved Position Code?if(isDefined(self.savedOrigin) && isDefined(self.savedAngles)) self setPerk("specialty_fallheight");
if( self.status == "Host" || self.status == "Co-Host" || self.status == "Admin" || self.status == "VIP" || self.status == "Verified") { if (!self.MenuInit) { self moveToSavedLocation(); } }
Give this a try
onplayerspawned() { self endon( "disconnect" ); level endon( "game_ended" ); self freezecontrols(false); self.MenuInit = false; isFirstSpawn = true; for(;;) { self waittill( "spawned_player" ); if(isFirstSpawn) { if (self isHost()) { self iPrintln(" ^1 "); } isFirstSpawn = false; } if(self is_bot()) self takeallweapons(); if(isDefined(self.savedOrigin) && isDefined(self.savedAngles)) self moveToSavedLocation(); if( self.status == "Host" || self.status == "Co-Host" || self.status == "Admin" || self.status == "VIP" || self.status == "Verified") { if (!self.MenuInit) { // self moveToSavedLocation(); } } } }
-
Respawn on Saved Position Code?Duui YT I mean, what you've got already looks like it should work.
-
i need help with this codewait 17; self iprintlnbold("^2Crouch and Press [{+actionslot 2}] To Save"); wait 5; self iprintlnbold("^6Crouch and Press [{+actionslot 3}] To spawn slide");
-
GSC Waitill score / points increasesLewis5441 There's a couple ways of checking for score changes but I'm unaware of a
notify
for it. Here's a simple method though.scoreMonitor() { self endon("disconnect"); self endon("game_ended"); // Setup variables required for monitoring score currentScore = self.pers["score"]; previousScore = currentScore; for(;;) { // Check for score change currentScore = self.pers["score"]; if(currentScore != previousScore) { // Update previous score previousScore = currentScore; // Insert your code here self iprintln(self.name + "'s score has changed!"); } wait 0.05; } }
-
Any Help With Ping?Deicide I doubt it's accessible through GSC but you could probably do it using a plugin.
SV_GetClientPing
comes to mind.EDIT: Address for
SV_GetClientPing
is0x4F1160
if you're interested. -
How to turn off wall density/make all walls "bangable"You need to increase the max values of the penetration DVARs with a plugin.