09.03.2014, 13:47
This tutorial will show you guys how you can extract possible player id's from OnRconLoginAttempt. Note: If multiple players are on with the same IP it might not work correctly. Alright, so the first thing are the requirements for this tutorial:
Basic SA:MP Pawn Package(sa-mp.com/downloads)
Foreach Include(OPTIONAL)
Then just put your includes at the top...
#include a_samp
#include foreach // Optional
Okay, so let's get started. You'll need to put OnRconLoginAttempt...
Okay so assuming we're using foreach(foreach include) you'll need to define "i" which will be the connected players.
Now the first thing we'll do is check if the IP matches the IP that attempted to login to RCON... But first we'll need to loop through the IP'S...
NOTE: If you don't want to use foreach replace foreach with:
So now you can have a playerid to work with... If you have any questions regarding this tutorial feel free to ask.
- Abagail
Basic SA:MP Pawn Package(sa-mp.com/downloads)
Foreach Include(OPTIONAL)
Then just put your includes at the top...
#include a_samp
#include foreach // Optional
Okay, so let's get started. You'll need to put OnRconLoginAttempt...
Code:
public OnRconLoginAttempt(ip[], password[], success) { return 1; }
Code:
foreach(Player, i) {
Code:
new iIP; GetPlayerIp(i,iIP, sizeof(iIP)); if(!strcmp(ip, pip, true)) // Now we'll use strcmp to check if they match. { // Don't forget your bracket. // new playerid = i; if(playerid == INVALID_PLAYER_ID) return 0; // Your code bla bla bla } }
Code:
for(new i=0; i<MAX_PLAYERS; i++) {
- Abagail