[HELP] Auto spawn under Onplayerconnect ?
#1

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 0td 5td++)
    {
        
TextDrawShowForPlayer(playeridServerTD[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(AKApIPGetName(playerid));
        
INI_Close(AKA);
    }
    else if(
strfind(akaGetName(playerid), true) == -1)
    {
        
format(GoFile,sizeof(GoFile),"ServerLogs/aka.ini");
        
format(Jstr,sizeof(Jstr),"%s,%s"akaGetName(playerid));
        new 
INI:AKA INI_Open(GoFile);
        
INI_WriteString(AKApIPJstr);
        
INI_Close(AKA);
    }
    if(
strlen(aka) > 70)
    {
        
strmid(Jstring,aka,0,70);
        
format(Jstrsizeof(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(Jstrsizeof(Jstr),"%s"Jstring);
        
MessAdmins(COLOR_TOMATO,Jstr);
    }
    else
    {
        if(
strlen(aka) > 2format(Jstrsizeof(Jstr),"Sign in >> Player: %s(%d) - IP: %s - AKA: %s"GetName(playerid),playerid,playerIP aka);
        else 
format(Jstrsizeof(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(playeridCodesizeof Code);
    
format(Linesizeof(Line), LocationCode);
    if(
fexist(Line)) return Kick(playerid);
    return 
1;

Under on my OnPlayerRequestClass
PHP код:
public OnPlayerRequestClass(playeridclassid)
{
    if(
pInfo[playerid][Login] == 0// This will show Dialog Login/Register
    
{
        new 
query[500];
           
GetPlayerIp(playeridIP[playerid], 16);
           
mysql_format(mysqlquerysizeof(query),"SELECT `Password`, `ID`, `Baned`, `BanedReason` FROM `players` WHERE `Username` = '%e' LIMIT 1"GetName(playerid));
           
mysql_tquery(mysqlquery"OnAccountCheck""i"playerid);
    }
    
// business
    
pInfo[playerid][CurrentBusiness] = 0;
    
// houses
    
pInfo[playerid][CurrentHouse] = 0;
    
SetPlayerPos(playerid2082.1281731187.39880310.820312);
    
SetPlayerFacingAngle(playerid49.730384);
    
SetPlayerCameraLookAt(playerid2082.1281731187.39880310.820312);
    
SetPlayerCameraPos(playerid2082.128173 + (floatsin(-49.730384degrees)), 1187.398803 + (floatcos(-49.730384degrees)), 10.820312);
    
GameTextForPlayer(playerid,"~<~ ~g~~h~Pilih Skin ~>~",3000,4);
    
// Play sound
    
PlayerPlaySound(playeridSERVER_SOUND0.00.010.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
Reply
#2

Show us your OnPlayerSpawn script.
Reply
#3

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 PlayerColorsrandom200 ) ];
        
SetPlayerColor(playerid,exd);
        
pInfo[playerid][Color] = exd;
    }
    if(
pInfo[playerid][Skin] != -&& GPVI(playerid,"mGameType") != 1)
    {
        
SetPlayerSkin(playerid,pInfo[playerid][Skin]);
    }
    
// money bag
    
if(pInfo[playerid][GetMoney] == 1)
    {
        
SetPlayerAttachedObject(playerid9155010.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] != && pInfo[playerid][Minigame] != && pInfo[playerid][InWar] != 1)
     {
        
SpawnHouse(playerid);
    }
    
    
// Vips system
    
if(pInfo[playerid][VIP] != || pInfo[playerid][Admin] > 5)
    {
        
SetPlayerArmour(playerid,50);
    }
    
    
// Jail system
    
if(pInfo[playerid][JailTime] != 0)
    {
        
SetPlayerJail(playerid);
    }
    
    
PlayerPlaySound(playerid11860.00.00.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
Reply
#4

Sorry for bumping.
But still have same problem
When onplayerconnet and return OnplayerRequestClass player got Auto Spawned

Anione can help me?
Reply
#5

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);
Reply
#6

*nvm misunderstood delete pls*
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)