Hey,
ich bräuchte jemanden, der mir das hier korrekt Hooked:
#define ForAllPlayers(%0) for(new index_%0=0,%0=ConnectedPlayerList[0]; index_%0<ConnectedPlayers; index_%0++,%0=ConnectedPlayerList[index_%0])
new ConnectedPlayers;
new ConnectedPlayerList[MAX_PLAYERS+1];
forward FAP_OnPlayerConnect(playerid);
forward FAP_OnPlayerDisconnect(playerid, reason);
public OnPlayerConnect(playerid){
if(!IsPlayerNPC(playerid))
AddPlayer(playerid);
return FAP_OnPlayerConnect(playerid);
}
public OnPlayerDisconnect(playerid, reason){
if(!IsPlayerNPC(playerid))
RemovePlayer(playerid);
return FAP_OnPlayerDisconnect(playerid, reason);
}
#define OnPlayerConnect FAP_OnPlayerConnect
#define OnPlayerDisconnect FAP_OnPlayerDisconnect
stock AddPlayer(playerid){
if(ConnectedPlayers>=MAX_PLAYERS || playerid<0 || playerid>=MAX_PLAYERS) return 0;
ConnectedPlayerList[ConnectedPlayers++]=playerid;
return 1;
}
stock RemovePlayer(playerid){
for(new i;i<ConnectedPlayers;i++){
if(ConnectedPlayerList[i]==playerid){
ConnectedPlayers--;
ConnectedPlayerList[i]=ConnectedPlayerList[ConnectedPlayers];
return 1;
}
}return 0;
}
Warnings:
warning 201: redefinition of constant/macro (symbol "OnPlayerConnect")
warning 201: redefinition of constant/macro (symbol "OnPlayerDisconnect")
Ich kenn mich mit dem Hooken nicht so gut aus...
Danke im Vorraus!
MfG,
- niklasbollmer