SA-MP Forums Archive
Bus System dosnt work.. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Bus System dosnt work.. (/showthread.php?tid=399840)



Bus System dosnt work.. - Don_Cage - 16.12.2012

Hello guys..
I am using [NPC]Bus System Filterscript that is made by Adil but the NPC drivers spawns and then gets dissconnected please help me! I was told that the problem is in here
pawn Код:
public OnPlayerSpawn(playerid)
{
   
    SetRealMoney(playerid, ScriptMoney[playerid]);
    new pName[MAX_PLAYER_NAME];
    new string[128];
    InitLockDoors(playerid);
    if(IsPlayerNPC(playerid)) return 1;
    STDPlayer[playerid] = 0;
    gTeam[playerid] = PlayerInfo[playerid][pTeam]; //Set the Team
    if (gTeam[playerid] == 4) //medic / criminal reset team
    {
        gTeam[playerid] = 3;
    }
    if(gPlayerLogged[playerid] == 0 && IsPlayerNPC(playerid))
    {
        SendClientMessage(playerid, COLOR_LIGHTRED, "** This server requires a Login BEFORE spawn (Kicked) **");
        Kick(playerid);
    }
and that i should add
pawn Код:
&& IsPlayerNPC(playerid)
to this line
pawn Код:
if(gPlayerLogged[playerid] == 0)
to make it
pawn Код:
if(gPlayerLogged[playerid] == 0 && IsPlayerNPC(playerid))
But even after i changed it the NPC is still dissconnecting so i really need help with this please!


Re: Bus System dosnt work.. - CyNiC - 16.12.2012

Try to change the line for:

pawn Код:
if(gPlayerLogged[playerid] == 0 && !IsPlayerNPC(playerid))



Re: Bus System dosnt work.. - willsuckformoney - 16.12.2012

Remove the && !IsPlayerNPC from there and add this under OnPlayerConnect
pawn Код:
public OnPlayerConnect(playerid)
{
    if(IsPlayerNPC(playerid)) return gPlayerLogged[playerid] = 1;
    return 1;
}



Re: Bus System dosnt work.. - Don_Cage - 16.12.2012

didnt work


Re: Bus System dosnt work.. - willsuckformoney - 16.12.2012

pawn Код:
public OnPlayerSpawn(playerid)
{
   
    SetRealMoney(playerid, ScriptMoney[playerid]);
    new pName[MAX_PLAYER_NAME];
    new string[128];
    InitLockDoors(playerid);
    STDPlayer[playerid] = 0;
    gTeam[playerid] = PlayerInfo[playerid][pTeam]; //Set the Team
    if (gTeam[playerid] == 4) //medic / criminal reset team
    {
        gTeam[playerid] = 3;
    }
    if(gPlayerLogged[playerid] == 0)
    {
        SendClientMessage(playerid, COLOR_LIGHTRED, "** This server requires a Login BEFORE spawn (Kicked) **");
        Kick(playerid);
    }
pawn Код:
public OnPlayerConnect(playerid)
{
    if(IsPlayerNPC(playerid)) return gPlayerLogged[playerid] = 1;
    return 1;
}
That doesn't work?


Re: Bus System dosnt work.. - maramizo - 16.12.2012

pawn Код:
public OnPlayerSpawn(playerid)
{
    SetRealMoney(playerid, ScriptMoney[playerid]);
    new pName[MAX_PLAYER_NAME];
    new string[128];
    InitLockDoors(playerid);
    STDPlayer[playerid] = 0;
    gTeam[playerid] = PlayerInfo[playerid][pTeam]; //Set the Team
    if (gTeam[playerid] == 4) //medic / criminal reset team
    {
        gTeam[playerid] = 3;
    }
    if(gPlayerLogged[playerid] == 0 && !IsPlayerNPC(playerid))
    {
        SendClientMessage(playerid, COLOR_LIGHTRED, "** This server requires a Login BEFORE spawn (Kicked) **");
        Kick(playerid);
    }
This should work, but it your own code should've worked in the first place.
Interesting... Try my code.


Re: Bus System dosnt work.. - Don_Cage - 16.12.2012

Quote:
Originally Posted by willsuckformoney
Посмотреть сообщение
pawn Код:
public OnPlayerSpawn(playerid)
{
   
    SetRealMoney(playerid, ScriptMoney[playerid]);
    new pName[MAX_PLAYER_NAME];
    new string[128];
    InitLockDoors(playerid);
    STDPlayer[playerid] = 0;
    gTeam[playerid] = PlayerInfo[playerid][pTeam]; //Set the Team
    if (gTeam[playerid] == 4) //medic / criminal reset team
    {
        gTeam[playerid] = 3;
    }
    if(gPlayerLogged[playerid] == 0)
    {
        SendClientMessage(playerid, COLOR_LIGHTRED, "** This server requires a Login BEFORE spawn (Kicked) **");
        Kick(playerid);
    }
pawn Код:
public OnPlayerConnect(playerid)
{
    if(IsPlayerNPC(playerid)) return gPlayerLogged[playerid] = 1;
    return 1;
}
That doesn't work?
pawno crashes


Re: Bus System dosnt work.. - CyNiC - 16.12.2012

You forgot to close the last braket on OnPlayerSpawn...


Re: Bus System dosnt work.. - Don_Cage - 16.12.2012

This is how it was before
pawn Код:
public OnPlayerConnect(playerid)
{




    // all saints hostpital
    RemoveBuildingForPlayer(playerid, 1410, 2487.3984, -1688.1016, 13.2813, 0.25);
    RemoveBuildingForPlayer(player
and this is what a changed it to
pawn Код:
public OnPlayerConnect(playerid)
{
    if(IsPlayerNPC(playerid)) return gPlayerLogged[playerid] = 1;
    return 1;
}




    // all saints hostpital
    RemoveBuildingForPlayer(playerid, 1410, 2487.3984, -1688.1016, 13.2813, 0.25);
    RemoveBuildingForPlayer(player



Re: Bus System dosnt work.. - maramizo - 16.12.2012

pawn Код:
public OnPlayerSpawn(playerid)
{
    SetRealMoney(playerid, ScriptMoney[playerid]);
    new pName[MAX_PLAYER_NAME];
    new string[128];
    InitLockDoors(playerid);
    STDPlayer[playerid] = 0;
    gTeam[playerid] = PlayerInfo[playerid][pTeam]; //Set the Team
    if (gTeam[playerid] == 4) //medic / criminal reset team
    {
        gTeam[playerid] = 3;
    }
    if(gPlayerLogged[playerid] == 0 && !IsPlayerNPC(playerid))
    {
        SendClientMessage(playerid, COLOR_LIGHTRED, "** This server requires a Login BEFORE spawn (Kicked) **");
        Kick(playerid);
    }
    return 1;
}