Trying to do stuff to otherplayers but I am having issues.
-
Hey, I'm having a small issue. I am messing around with making some bot logic and for some reason it is applying to the localplayer too. Any help would be nice!
I am still learning the GSC syntax so please excuse bad code.
for (;;) { for ( i=0; i < level.players.size; i++ ) { player = level.players[i]; if (player != self) { player setPlayerAngles(vectortoangles(self getTagOrigin("j_head") - player getEye())); } wait 0.1; } wait 0.1; }
-
peep try
self.name
instead of self and if it's still the same tryplayer.name
andself.name
-
Resxt Already tried this and it's the same outcome
-
peep Show the rest of the code. Are you using GSC Studio? GSC Studio give syntax errors also on many cases where there no issue
-
Sorex No. I am using VSCode. There are no code errors and that is my whole function. My issue is that it applies to me and the bots. I ONLY want it to apply to bots / other players.
-
peep So your function don't have a name. Please show the full code of this aimbot
-
Sorex It's not meant to be an aimbot.
It's setting the localplayers view angles and the bots view angles.
I only want to set the bots view angles.
botsmovement(player) { self endon("disconnect"); for (;;) { wait 0.05; for ( i=0; i < level.players.size; i++ ) { player = level.players[i]; if (player.name != self.name) { player setPlayerAngles(vectortoangles(self getTagOrigin("j_head") - player getEye())); } } } }
-
isBot( entity ) { return isDefined(entity.pers["isBot"]) && entity.pers["isBot"]; } botsmovement() { level endon("game_ended"); for (;;) { wait 0.05; for ( i=0; i < level.players.size; i++ ) { player = level.players[i]; if (!isBot( player) && player.name != self.name) { player setPlayerAngles(vectortoangles(self getTagOrigin("j_head") - player getEye())); } } } }
Call
level thread botsmovement();
in your init and should work fine. There no syntax error here. -
Sorex Thank you for the response, This doesn't work.
I'm not sure if "isBot" works in MW3 but I could be wrong.
-
peep my pad it work just with players change !isBot( player) with isBot( player). Remove the ! in front
-
Sorex Still doesn't work my man
Is it possible for me to check if a string contains a certain word?
For example
if (player.name contains("bot")) { //do stuff to bots here }
is this possible in gsc?
-
peep isBot does work if you're using Bot Warfare
Human players don't have isBot, it's undefined
Bots have it set to true. See my example here https://github.com/Resxt/Plutonium-IW5-Scripts/blob/main/actions_on_button_press/camera_switch_vote_on_button_press.gsc#L84(In my case I check for human players only so I check for undefined and false so check for defined and true instead)
-
Resxt Thanks for the reply but I got it working, I did this.
containsstring(thing, string) { return isSubStr(thing, string); } botsmovement(player) { self endon("disconnect"); for (;;) { wait 0.05; for ( i=0; i < level.players.size; i++ ) { player = level.players[i]; if (containsstring(player.name, "bot")) { player setPlayerAngles(vectortoangles(self getTagOrigin("j_head") - player getEye())); } } } }