19.10.2014, 15:59
You don't have to use format to copy a string, use strcat or strcpy instead. Secondly, there's no need to check if player is connected when you're using foreach. It adds in players to it's array when player connects.
Your loop is incorrect, it checks if player is connected and then skips if player is connected. Also in case if the player is logged in as RCON, it will also skip that player since they're logged in. Mistakes do happen though. Also, I don't see the variable "i" declared under foreach. I'm not sure how the latest foreach works, so please correct me if I'm wrong. Oh and returning 1 inside a loop will not get your function work the way you want, it will return 1 as soon after one single index is done.
EDIT : I just noted this:
It's not how continue statement work. It skips and continues to the next loop if that's used. You can take a look at this topic, it has explained looping structures very well and I suggest you to read that.
https://sampforum.blast.hk/showthread.php?tid=305770
Quote:
For this example, we'll make a function to stream a URL for online rcon administrators.
pawn Code:
|
EDIT : I just noted this:
Quote:
Basically, - this runs a loop. Then, it checks if the player is connected. If so, - the loop continues. Same thing with checking if the player is logged into RCON.
|
https://sampforum.blast.hk/showthread.php?tid=305770