Money at First Spawn (Urgent help)
#1

Guys, i've a problem with the money at first spawn, i'm using this:

pawn Код:
public OnPlayerConnect(playerid)
{
    SetPVarInt(playerid, "FirstSpawn", 1); //The player is going to spawn for the first time
    return 1;
}

public OnPlayerSpawn(playerid)
{
    if(GetPVarInt(playerid, "FirstSpawn")) //If its the first time the player has spawned
    {
        GivePlayerMoney(playerid, 3000);
        PlayerInfo[playerid][pMoney] = 3000;
        SetPVarInt(playerid, "FirstSpawn", 1);
    }
    return 1;
}
But is not working, i used them like this:

pawn Код:
stock SpawnChar(playerid)
{
    if(IsPlayerLoggedIn(playerid))
    {
        //Money at first Spawn
        if(!GetPVarInt(playerid, "FirstSpawn")) //If its the first time the player has spawned
        {
            GivePlayerMoney(playerid, 3000);
            PlayerInfo[playerid][pMoney] = 3000;
            SetPVarInt(playerid, "FirstSpawn", 1);
        }
        // Legit Loyalty
        if(!PlayerInfo[playerid][pLoyal] && PlayerInfo[playerid][pHours] < 24) {PlayerInfo[playerid][pLoyal] = 1;}
        // Safe Admin
        if(PlayerInfo[playerid][pAdmin] && !PlayerInfo[playerid][pSafeAdmin] && !aDuty[playerid])
        {
            new string[128];
            format(string, sizeof(string), "%s (%s) has been flagged as an unsafe admin.", RPN(playerid), RPIP(playerid));
            Log("logs/safeadmin.log", string);
            Kick(playerid);
        }
        // Family Strikes
        if(PlayerInfo[playerid][pFam])
        {
            new idx = PlayerInfo[playerid][pFam];
            if(FamInfo[idx][fStrikes] >= 3)
            {
                PlayerInfo[playerid][pFam] = 0;
                PlayerInfo[playerid][pFamRank] = 0;
                SendClientMessage(playerid, COLOR_LIGHTBLUE, "Your family has been disbanded due to having 3 strikes, you have been autokicked from the family.");
            }
        }
        // Login textdraws
        TextDrawHideForPlayer(playerid, LoginTD);
        TextDrawHideForPlayer(playerid, CreekTD);
        TextDrawHideForPlayer(playerid, LineTD);
        TextDrawHideForPlayer(playerid, ForumTD);
        // Palomino Creek Roleplay
        TextDrawShowForPlayer(playerid, PalominoTD);
        // Website
        TextDrawShowForPlayer(playerid, WebTD);
        // Time
        TextDrawShowForPlayer(playerid, TimeTD);
        // Name Color & Level & Wanted Level
        SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]);
        SetPlayerColor(playerid, TRANSPARENT_WHITE);
        SetPlayerWantedLevel(playerid, PlayerInfo[playerid][pWanted]);
        // Download bar
        Download[playerid] = CreateProgressBar(499.00, 103.00, 107.50, 3.20, -16776961, 100.0);
        SetProgressBarMaxValue(Download[playerid], 100);
        SetProgressBarColor(Download[playerid], COLOR_GREEN);
        // Custom Int
        if(PlayerInfo[playerid][pSpawnFreeze])
        {
            SetTimerEx("EnterExitTimer", 5000, false, "i", playerid);
        }
        // Business, House and Gates Checking
        if(PlayerInfo[playerid][pBiz] != 0 && strcmp(RPNU(playerid), BizInfo[PlayerInfo[playerid][pBiz]][bOwner]) || PlayerInfo[playerid][pBiz] != 0 && !strlen(BizInfo[PlayerInfo[playerid][pBiz]][bOwner]))
        {
            PlayerInfo[playerid][pBiz] = 0;
            SendClientMessage(playerid, COLOR_WHITE, " An administrator has sold your business while you were offline.");
        }
        if(PlayerInfo[playerid][pHouse] != 0 && strcmp(RPNU(playerid),  HouseInfo[PlayerInfo[playerid][pHouse]][hOwner]) || PlayerInfo[playerid][pHouse] != 0 && !strlen(HouseInfo[PlayerInfo[playerid][pHouse]][hOwner]))
        {
            PlayerInfo[playerid][pHouse] = 0;
            SendClientMessage(playerid, COLOR_WHITE, " An administrator has sold your house while you were offline.");
        }
        new idx; idx = PlayerInfo[playerid][pGate][0]; // Gate slot 1
        if(idx && !GateInfo[idx][gModel])
        {
            PlayerInfo[playerid][pGate][0] = 0;
            SendClientMessage(playerid, COLOR_WHITE, " An administrator has deleted your gate in slot 1 while you were offline.");
        }
        idx = PlayerInfo[playerid][pGate][1]; // Gate slot 2
        if(idx && !GateInfo[idx][gModel])
        {
            PlayerInfo[playerid][pGate][1] = 0;
            SendClientMessage(playerid, COLOR_WHITE, " An administrator has deleted your gate in slot 2 while you were offline.");
        }
        idx = PlayerInfo[playerid][pGate][2]; // Gate slot 3
        if(idx && !GateInfo[idx][gModel])
        {
            PlayerInfo[playerid][pGate][2] = 0;
            SendClientMessage(playerid, COLOR_WHITE, " An administrator has deleted your gate in slot 3 while you were offline.");
        }
        //Factions Spawn
        if (PlayerInfo[playerid][pFac] == 0)//Civ Spawn
        {
            if(PlayerInfo[playerid][pHospital])
                {
                Hospital[playerid] = random(2);
                if(Hospital[playerid] == 0)
                    {
                        SetPlayerPos(playerid, 2253.0479,360.5177,11.5480);
                        SetPlayerCameraPos(playerid,2249.8252,101.2665,41.2377);
                        SetPlayerCameraLookAt(playerid,2270.3330,82.0429,30.0284);
                    }
                    else if(Hospital[playerid] == 1)
                    {
                        SetPlayerPos(playerid, 2253.0479,360.5177,11.5480);
                        SetPlayerCameraPos(playerid,2249.8252,101.2665,41.2377);
                        SetPlayerCameraLookAt(playerid,2270.3330,82.0429,30.0284);
                    }
                ResetZaiatWeapons(playerid);
                PlayerInfo[playerid][pFacDuty] = 0;
                SetPlayerVirtualWorld(playerid, 0);
                TogglePlayerControllable(playerid, 0);
                HospitalTime[playerid] = 30;
                if(PlayerInfo[playerid][pVIP] >= 2) HospitalTime[playerid] = 1;
                HospitalCountDown[playerid] = SetTimerEx("HospitalTimer", 1000, false, "d", playerid);
                }
            //for(new i = 0; i < 13; i++)
            //if(PlayerInfo[playerid][pWeapon][i]) GiveZaiatWeapon(playerid, PlayerInfo[playerid][pWeapon][i], PlayerInfo[playerid][pWeaponAmmo][i]);
            SetPlayerInterior(playerid,0);
            SetPlayerVirtualWorld(playerid,0);
            SetPlayerPos(playerid,2103.3633,-103.6316,2.2756);
            SetPlayerFacingAngle(playerid, 301.8174);
            SetPlayerHealth(playerid, 100);
            SetPlayerArmour(playerid, 0);
            SetPlayerSkin(playerid,PlayerInfo[playerid][pModel]);
            return 1;
            }
I tryed to put it under Civ Spawn but each time ppl log in they get 3k as the start. Please help me as soon as you can, thank you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)