No Double Posting - There is a modify button , use it. However, bumping a topic in which you have or require further information is allowed after at least 24 hours. Note that two identical posts appearing at the same time is usually a mistake attributed to lag, and will not be penalizsed (but the second one will be removed). |
/////////////////////////////////////////////////////
///////////// Script by Abhinav ////////////////////
///////////////////////////////////////////////////
#include <a_samp>
#define COLOR_JOIN 0x99FF9900
new Params[4][8];
new FileData[7][128];
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Country FileScript by Abhinav");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
enum pInfo
{
pPassword[128],
pCash,
pAccount,
pAdmin,
pLevel,
pExp,
gPupgrade,
pKills,
pCB,
pHW,
pSR,
pWA,
pPEN,
pGun1,
pGun2,
pGun3,
pGun4,
pGun5,
pGun6,
pGun7,
pGun8,
pGun9,
pGun10,
pGun11,
pGun12,
pGun13,
pAmmo1,
pAmmo2,
pAmmo3,
pAmmo4,
pAmmo5,
pAmmo6,
pAmmo7,
pAmmo8,
pAmmo9,
pAmmo10,
pAmmo11,
pAmmo12,
pAmmo13,
Float:pSHealth,
Float:pHealth,
Float:pPos_x,
Float:pPos_y,
Float:pPos_z,
pInt,
pLocal,
pTeam,
pModel,
pPnumber,
pHousekey,
pPbiskey,
pBanned,
pLockTime,
pFightSkill,
pHotwireSkill,
pSex,
pAge,
pTut,
pMember,
pRank,
pCrashed,
Float:pCrashArmour,
Float:pCrashHealth,
pWorld,
pJob,
pPayCheck,
pPayDay,
pDonateRank,
pConnectTime,
pDonateTime,
pJailed,
pJailTime,
pJailReason[128],
pDrugs,
pMats,
pVaultOwned,
pVaultDrugs,
pVaultMats,
pWatch,
pPhoneBook,
pMask,
pMaskUse,
pDrivLic,
pCarkey,
pCarkey2,
pCarkey3,
pMarried,
pMarriedTo[128],
pHelper,
pGunLic,
pArrested,
pCrimes,
pTaunt[128],
pInvWeapon,
pInvAmmo,
pInvBeer,
pInvWine,
pInvCiggy,
pHidden,
pWalkie,
pWalkieFreq,
pLighter,
pCigs,
pIRC,
pBanReason[128],
pFish[5],
pFishes1[128],
pFishes2[128],
pFishes3[128],
pFishes4[128],
pFishes5[128],
pNote1[128],
pNote1s,
pNote2[128],
pNote2s,
pNote3[128],
pNote3s,
pNote4[128],
pNote4s,
pNote5[128],
pNote5s,
pAccent[128],
pVoted,
pAdmName[128],
pHeadValue,
pHiddenNum,
pPmMsg[128],
Float:Clothesx,
Float:Clothesy,
Float:Clothesz,
Clothesw,
Clothesi,
Clothesent,
pRadio,
pTicket[5],
pTicketReason0[128],
pTicketReason1[128],
pTicketReason2[128],
pTicketReason3[128],
pTicketReason4[128],
pTicketDate0[128],
pTicketDate1[128],
pTicketDate2[128],
pTicketDate3[128],
pTicketDate4[128],
pApp[128],
pSkate,
pSpeaker,
pChanges,
pAdminPass[128],
pFamNum,
pTattoo[128],
pCellphone,
pCelltime,
pCellplan,
pDonerGate1,
pFurnLocked,
pCalledTutSay,//lame fix to double msg on join
pDonatorCarDate,
pAdPending,
pPendingAdText[256],
pWarrant,
pWarrantReason[256],
pWakeMsgSend,
pFactionIden,
pWeaponData[13],
pWeaponAmmo[13],
pLagTimer,//2 seconds or so of being excempt from cheat checking(weapons/armour only)
Float:pArmour,
pGasCan,
pFH,
pFB,
pDcoins,
pID,
pActions,
};
new PlayerInfo[MAX_PLAYERS][pInfo];
public OnPlayerConnect(playerid)
{
new Country[256];
GetPlayerCountry(playerid,Country);
new mess[256],IP[256];
GetPlayerIp(playerid,IP,sizeof(IP));
if (PlayerInfo[playerid][pAdmin] >= 1)
{
format(mess,sizeof(mess),"%s has joined the server. (Country: %s | IP Address: %s | Ping: %i)",GetPName(playerid),Country,IP,GetPlayerPing(playerid));
SendClientMessage(playerid,COLOR_JOIN,mess);
printf(mess);
}
else
{
format(mess,sizeof(mess),"%s has joined the server from %s.",GetPName(playerid),Country);
SendClientMessageToAll(COLOR_JOIN, mess);
printf(mess);
}
return 1;
}
GetParams(Source[]){
new Destination[256];
new SLen=strlen(Source);
new at,pos=0,tp=0;
new tempo[256];
////////////// Clearing DATA ///////////////// FOR LOOP WAS NOT WORKING FOR THIS PURPOSE
format(Params[0],sizeof(Params),"");
format(Params[1],sizeof(Params),"");
format(Params[2],sizeof(Params),"");
format(Params[3],sizeof(Params),"");
/////////////////////////////////////////////
for(at=pos;at<=SLen;at++){
strmid(tempo,Source,at,at+1,sizeof(tempo));
if(!strcmp(tempo,".",true)){
if(tp<=10){
strmid(Destination,Source,pos,at,sizeof(Destination));
format(Params[tp][0],256,"%s",Destination);
tp=tp+1;
}
pos=at+1;
}
}
return 1;
}
GetFileData(Source[]){
new Destination[256];
new SLen=strlen(Source);
new at,pos=0,tp=0;
new tempo[256];
////////////// Clearing DATA ///////////////// FOR LOOP WAS NOT WORKING FOR THIS PURPOSE
format(FileData[0],sizeof(FileData),"");
format(FileData[1],sizeof(FileData),"");
format(FileData[2],sizeof(FileData),"");
format(FileData[3],sizeof(FileData),"");
format(FileData[4],sizeof(FileData),"");
format(FileData[5],sizeof(FileData),"");
format(FileData[6],sizeof(FileData),"");
/////////////////////////////////////////////
for(at=pos;at<=SLen;at++){
strmid(tempo,Source,at,at+1,sizeof(tempo));
if(!strcmp(tempo,",",true)){
if(tp<=10){
strmid(Destination,Source,pos,at,sizeof(Destination));
format(FileData[tp][0],256,"%s",Destination);
tp=tp+1;
}
pos=at+1;
}
}
return 1;
}
GetPlayerCountry(playerid,Country[256]){
new IPAddress[256];
new a,b,c,d,ipf;
new File:IPFile;
new Text[256],start,end;
GetPlayerIp(playerid,IPAddress,sizeof(IPAddress));
GetParams(IPAddress);
a=strval(Params[0]);
b=strval(Params[1]);
c=strval(Params[2]);
d=strval(Params[3]);
if(a==127 && b==0 && c==0 && d==1){
format(Country,sizeof(Country),"Localhost");
return 1;
}
ipf = (16777216*a) + (65536*b) + (256*c) + d;
if(!fexist("CountriesIPs/IPLIST.csv")) return SendClientMessage(playerid,0xFF0000FF,"Country file not found.");
IPFile=fopen("CountriesIPs/IPLIST.csv",io_read);
fread(IPFile,Text,sizeof(Text),false);
while(strlen(Text)>0){
GetFileData(Text);
start=strval(FileData[0]);
end=strval(FileData[1]);
if(ipf>=start && ipf<=end){
format(Country,sizeof(Country),"%s(%s)",FileData[6],FileData[5]);
fclose(IPFile);
return 1;
}
fread(IPFile,Text,sizeof(Text),false);
}
fclose(IPFile);
return 1;
}
GetPName(playerid){
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
return name;
}