[HELP] Auto spawn under Onplayerconnect ? -
VenomMancer - 24.06.2015
I am join in my server when under onplayerconnect i got
auto spawn and get kick.
Because Under OnplayerSpawn(playerid) i make if who not loggedin and click spawn in OnPlayerRequestClass will return get Kick from server.
How to stop it ?
Btw this my script under oplayerconnect
PHP код:
public OnPlayerConnect(playerid)
{
ResetVar(playerid);
if(InvalidName(GetName(playerid)))
{
new str[200], wlcm[500];
format(str,200,"{FF0000}|- %s[%d] telah otomatis di Kick. | Karena : Nick menggunakan symbol [] atau () -|",GetName(playerid),playerid);
SCMTA(-1,str);
strcat(wlcm,"{FFFF00}Mohon maaf, nama anda tidak valid !\n");
strcat(wlcm,"Silahkan anda relog ! Anda hanya bisa menggunakan 0-9 atau a-z atau atau $ atau . atau _ dan =\n");
strcat(wlcm,"Ini berfungsi agar tidak ada yang fake Group/Gang\n");
strcat(wlcm,"Anda bisa menggunakan nama seperti ini : [VG]Kirito ketika sudah memiliki Group/Gang!\n");
sDialog(playerid,"Server-Message",wlcm);
pKick(playerid);
return 1;
}
ResetPlayerMoney(playerid);
SMT(playerid,"~n~~g~~h~Selamat datang di~n~~w~"SERVER_NAME"~n~~r~~h~Robbers~w~/~b~~h~DM~w~/~y~~h~Race~w~/~p~~h~Freeroam");
// TextDraw player
LoadPayerTD(playerid);
for(new td = 0; td < 5; td++)
{
TextDrawShowForPlayer(playerid, ServerTD[td]);
}
// Aka system
new GoFile[100],pIP[16],Jstr[1080],Jstring[1080];
strdel(aka,0,256);
GetPlayerIp(playerid,pIP,16);
GetPlayerIp(playerid,playerIP,16);
format(GoFile,sizeof(GoFile),"ServerLogs/aka.ini");
INI_ParseFile(GoFile,"GetAkaLog");
if(strlen(aka) < 3)
{
format(GoFile,sizeof(GoFile),"ServerLogs/aka.ini");
new INI:AKA = INI_Open(GoFile);
INI_WriteString(AKA, pIP, GetName(playerid));
INI_Close(AKA);
}
else if(strfind(aka, GetName(playerid), true) == -1)
{
format(GoFile,sizeof(GoFile),"ServerLogs/aka.ini");
format(Jstr,sizeof(Jstr),"%s,%s", aka, GetName(playerid));
new INI:AKA = INI_Open(GoFile);
INI_WriteString(AKA, pIP, Jstr);
INI_Close(AKA);
}
if(strlen(aka) > 70)
{
strmid(Jstring,aka,0,70);
format(Jstr, sizeof(Jstr),"Sign in >> Player: %s(%d) - IP: %s - AKA: %s", GetName(playerid),playerid,playerIP , Jstring);
MessAdmins(COLOR_TOMATO,Jstr);
strmid(Jstring,aka,70,sizeof(aka));
format(Jstr, sizeof(Jstr),"%s", Jstring);
MessAdmins(COLOR_TOMATO,Jstr);
}
else
{
if(strlen(aka) > 2) format(Jstr, sizeof(Jstr),"Sign in >> Player: %s(%d) - IP: %s - AKA: %s", GetName(playerid),playerid,playerIP , aka);
else format(Jstr, sizeof(Jstr),"Sign in >> Player: %s - IP: %s - AKA: No aka found!", GetName(playerid),playerIP);
MessAdmins(COLOR_TOMATO,Jstr);
}
// Create stunt island objects for the player
CreateSIObjects(playerid);
// ban code
new Code[128], Line[256];
gpci(playerid, Code, sizeof Code);
format(Line, sizeof(Line), Location, Code);
if(fexist(Line)) return Kick(playerid);
return 1;
}
Under on my OnPlayerRequestClass
PHP код:
public OnPlayerRequestClass(playerid, classid)
{
if(pInfo[playerid][Login] == 0) // This will show Dialog Login/Register
{
new query[500];
GetPlayerIp(playerid, IP[playerid], 16);
mysql_format(mysql, query, sizeof(query),"SELECT `Password`, `ID`, `Baned`, `BanedReason` FROM `players` WHERE `Username` = '%e' LIMIT 1", GetName(playerid));
mysql_tquery(mysql, query, "OnAccountCheck", "i", playerid);
}
// business
pInfo[playerid][CurrentBusiness] = 0;
// houses
pInfo[playerid][CurrentHouse] = 0;
SetPlayerPos(playerid, 2082.128173, 1187.398803, 10.820312);
SetPlayerFacingAngle(playerid, 49.730384);
SetPlayerCameraLookAt(playerid, 2082.128173, 1187.398803, 10.820312);
SetPlayerCameraPos(playerid, 2082.128173 + (5 * floatsin(-49.730384, degrees)), 1187.398803 + (5 * floatcos(-49.730384, degrees)), 10.820312);
GameTextForPlayer(playerid,"~<~ ~g~~h~Pilih Skin ~>~",3000,4);
// Play sound
PlayerPlaySound(playerid, SERVER_SOUND, 0.0, 0.0, 10.0);
// MYSQL
//if(pInfo[playerid][Login] == 0) return CekPlayer(playerid);
return 1;
}
How to fix my problem ?
#Sorry for my bad english
I am really need help guys
Re: [HELP] Auto spawn under Onplayerconnect ? -
Shetch - 24.06.2015
Show us your OnPlayerSpawn script.
Re: [HELP] Auto spawn under Onplayerconnect ? -
VenomMancer - 24.06.2015
Quote:
Originally Posted by Shetch
Show us your OnPlayerSpawn script.
|
Here:
PHP код:
public OnPlayerSpawn(playerid)
{
if(pInfo[playerid][Login] == 0) return Kick(playerid);
// Anti fake kill
SetPVarInt(playerid,"K_Times",0);
// business
pInfo[playerid][CurrentBusiness] = 0;
// house
pInfo[playerid][CurrentHouse] = 0;
// war system
if(pInfo[playerid][InWar] == 1)
{
SetPlayerPos(playerid,1351.4365,2147.5635,11.0156);
SetPlayerVirtualWorld(playerid,gInfo[pInfo[playerid][gID]][WarID]);
GivePlayerWeapon(playerid,26,999999999);
GivePlayerWeapon(playerid,24,999999999);
GivePlayerWeapon(playerid,32,999999999);
GivePlayerWeapon(playerid,31,999999999);
SMT(playerid,"~n~~r~~h~GROUP WAR !");
SMTD(playerid,"~r~|| ~w~Ketik ~y~/lgwar ~w~untuk keluar dari group war!",10);
}
if(pInfo[playerid][Color] == 0)
{
new exd = PlayerColors[ random( 200 ) ];
SetPlayerColor(playerid,exd);
pInfo[playerid][Color] = exd;
}
if(pInfo[playerid][Skin] != -1 && GPVI(playerid,"mGameType") != 1)
{
SetPlayerSkin(playerid,pInfo[playerid][Skin]);
}
// money bag
if(pInfo[playerid][GetMoney] == 1)
{
SetPlayerAttachedObject(playerid, 9, 1550, 1, 0.041999,-0.260000,-0.031999,41.500000,90.800010,123.799987,1.000000,1.000000,1.000000);
}
// Mnigames
if(pInfo[playerid][Minigame]== 1)
{
MinigamesJoin(playerid,GetPVarInt(playerid,"mGameType"));
}
else
{
LoadToys(playerid);
}
if( pInfo[playerid][JailTime] != 1 && pInfo[playerid][Minigame] != 1 && pInfo[playerid][InWar] != 1)
{
SpawnHouse(playerid);
}
// Vips system
if(pInfo[playerid][VIP] != 0 || pInfo[playerid][Admin] > 5)
{
SetPlayerArmour(playerid,50);
}
// Jail system
if(pInfo[playerid][JailTime] != 0)
{
SetPlayerJail(playerid);
}
PlayerPlaySound(playerid, 1186, 0.0, 0.0, 0.0);
// Race system
pInfo[playerid][InRace] = -1;
RaceCheckpoint[playerid] = -1;
// anims
AnimsLoad(playerid);
return 1;
}
The problem is, i got
Auto Spawned without reason.
#Sorryformybadenglish
Re: [HELP] Auto spawn under Onplayerconnect ? -
VenomMancer - 25.06.2015
Sorry for bumping.
But still have same problem
When onplayerconnet and return OnplayerRequestClass player got
Auto Spawned
Anione can help me?
Re: [HELP] Auto spawn under Onplayerconnect ? -
NeilC - 25.06.2015
Try this
Код:
public OnPlayerSpawn(playerid)
{
if(pInfo[playerid][Login] == 1)
{
if(pInfo[playerid][InWar] == 1)
{
SetPlayerPos(playerid,1351.4365,2147.5635,11.0156);
SetPlayerVirtualWorld(playerid,gInfo[pInfo[playerid][gID]][WarID]);
GivePlayerWeapon(playerid,26,999999999);
GivePlayerWeapon(playerid,24,999999999);
GivePlayerWeapon(playerid,32,999999999);
GivePlayerWeapon(playerid,31,999999999);
SMT(playerid,"~n~~r~~h~GROUP WAR !");
SMTD(playerid,"~r~|| ~w~Ketik ~y~/lgwar ~w~untuk keluar dari group war!",10);
}
if(pInfo[playerid][Color] == 0)
{
new exd = PlayerColors[ random( 200 ) ];
SetPlayerColor(playerid,exd);
pInfo[playerid][Color] = exd;
}
if(pInfo[playerid][Skin] != -1 && GPVI(playerid,"mGameType") != 1)
{
SetPlayerSkin(playerid,pInfo[playerid][Skin]);
}
// money bag
if(pInfo[playerid][GetMoney] == 1)
{
SetPlayerAttachedObject(playerid, 9, 1550, 1, 0.041999,-0.260000,-0.031999,41.500000,90.800010,123.799987,1.000000,1.000000,1.000000);
}
// Mnigames
if(pInfo[playerid][Minigame]== 1)
{
MinigamesJoin(playerid,GetPVarInt(playerid,"mGameType"));
}
else
{
LoadToys(playerid);
}
if( pInfo[playerid][JailTime] != 1 && pInfo[playerid][Minigame] != 1 && pInfo[playerid][InWar] != 1)
{
SpawnHouse(playerid);
}
// Vips system
if(pInfo[playerid][VIP] != 0 || pInfo[playerid][Admin] > 5)
{
SetPlayerArmour(playerid,50);
}
// Jail system
if(pInfo[playerid][JailTime] != 0)
{
SetPlayerJail(playerid);
}
PlayerPlaySound(playerid, 1186, 0.0, 0.0, 0.0);
// Race system
pInfo[playerid][InRace] = -1;
RaceCheckpoint[playerid] = -1;
// Anti fake kill
SetPVarInt(playerid,"K_Times",0);
// business
pInfo[playerid][CurrentBusiness] = 0;
// house
pInfo[playerid][CurrentHouse] = 0;
// anims
AnimsLoad(playerid);
}
else {
Kick(playerid);
}
return 1;
}
Or change the (from your original code not mine)
Код:
if(pInfo[playerid][Login] == 0) return Kick(playerid);
to
Код:
if(!pInfo[playerid][Login]) return Kick(playerid);
Re: [HELP] Auto spawn under Onplayerconnect ? -
FailerZ - 25.06.2015
*nvm misunderstood delete pls*