Driving School Cars Disappear
#1

Driving school cars randomly disappear when someone is taking there license. Also sometimes when people leave it removes the admins spawned cars. I will try get driving school ones fixed first

Spawning car on driving test
pawn Код:
if(dialogid==FIRSTDIALOG)
    {
        if(!response) return 1;
        switch(listitem)
        {
            case 0:
            {
                if(TheoryPassed[playerid]==1)return SendClientMessage(playerid,GREY,"You have already passed your theory test");
                ShowPlayerDialog(playerid,QUESTION1,DIALOG_STYLE_LIST,"Can Drugs affect your driving?","No,unless they've been prescribed by a Doctor\nYes\nNo","Select","");
            }
            case 1:
            {
                if(TheoryPassed[playerid]==1)
                {
                    Time[playerid]=gettime()+60*3;
                    GivePlayerMoneyEx(playerid,-500);
                    Licence[playerid][StepD]=1;
                    Licence[playerid][Vehicle]=AddStaticVehicleEx(496,-2025.3169,-96.5181,34.9307,90.1800,-1,-1,-1);
                    SetVehicleParamsEx(Licence[playerid][Vehicle],1,0,0,0,0,0,0);
                    PutPlayerInVehicle(playerid,Licence[playerid][Vehicle],0);
                    SetPlayerInterior(playerid,0);
                    GameTextForPlayer(playerid,"~r~-$500",1000,1);
                }else return SendClientMessage(playerid,GREY,"You need to pass your theory tests first");

            }
        }
    }
Player connecting to server
pawn Код:
public OnPlayerConnect(playerid)
{
    new string[128];
    CStats(playerid);
    VehicleBoost[playerid] = 0;
    LoadStats(playerid);
    TogglePlayerClock(playerid,1);
    TextDrawAlignment(Zones[playerid],2);
    TextDrawSetOutline(Zones[playerid],1);
    TextDrawAlignment(td_fuel[playerid],3);
    TextDrawSetOutline(td_fuel[playerid],1);
    TextDrawAlignment(sdisplay[playerid],3);
    TextDrawSetOutline(sdisplay[playerid],1);
    TextDrawLetterSize(Zones[playerid],0.4,2.5);
    TextDrawLetterSize(td_fuel[playerid],0.4,1.5);
    TextDrawLetterSize(sdisplay[playerid],0.4,1.5);
    for(new i=1;i<OrgsCount+1;i++){for(new a=1;a<Organization[i][ZoneCreated]+1;a++)
    {GangZoneShowForPlayer(playerid,Organization[i][OrgZones][a],Organization[i][ZoneColor][a]);}}
    format(string,sizeof(string),"*{A9C4E4}%s{FFFFFF} has joined the server",PlayerName(playerid));
    SendClientMessageToAll(-1,string);
    format(string,40,"~g~<~w~join~g~>~w~ %s",PlayerName(playerid));
    ConnectTextdraw(string);
    return 1;
}
Player spawning
pawn Код:
public OnPlayerSpawn(playerid)
{
    if(Died[playerid]==1)
    {
        Died[playerid]=0;
        ResetPlayerWeaponsEx(playerid);
        SetPlayerSkin(playerid,Skin[playerid]);
        if(IsPlayerInRangeOfPoint(playerid,2500,2034.6943,-1406.8729,17.1975))
        {
            SetPlayerPos(playerid,2034.6943,-1406.8729,17.1975);
        }
        if(IsPlayerInRangeOfPoint(playerid,2500,1578.3215,1768.5914,10.8203))
        {
            SetPlayerPos(playerid,1578.3215,1768.5914,10.8203);
        }
        if(IsPlayerInRangeOfPoint(playerid,2500,-2648.6311,635.9958,14.4531))
        {
            SetPlayerPos(playerid,-2648.6311,635.9958,14.4531);
        }
        if(!IsPlayerInRangeOfPoint(playerid,2500,-2648.6311,635.9958,14.4531)&&!IsPlayerInRangeOfPoint(playerid,2500,1578.3215,1768.5914,10.8203)&&!IsPlayerInRangeOfPoint(playerid,2500,2034.6943,-1406.8729,17.1975))
        {
            SetPlayerPos(playerid,1177.9857,-1323.0596,14.0977);
        }
    }
    if(Jailed[playerid]>0)
    {
        CagePlayer(playerid);
    }
    if(registered[playerid]==1)
    {
        registered[playerid]=0;
        SetPlayerInterior(playerid,0);
        SetPlayerVirtualWorld(playerid,0);
        GivePlayerMoneyEx(playerid,25000);
        Skin[playerid]=GetPlayerSkin(playerid);
        GameTextForPlayer(playerid,"~g~+$25000",800,1);
        SendClientMessage(playerid,LRED,"Welcome to Crimson Roleplay. Here is some information about the server!");
        SendClientMessage(playerid,LRED,"(REMEMBER - /guide is there to help you start your journey");
        SendClientMessage(playerid,LRED,"To reach the commands screen use - /cmds - To Reach the Rules screen use - /rules");
        SendClientMessage(playerid,LRED,"/help will also teach you more about the server and what Medium Roleplay is");
        SendClientMessage(playerid,LRED,"Enjoy your stay and always remember to ask and Admin if you need help!");
        SendClientMessage(playerid,LRED,"Each hour is one score, once you have enough Score you can apply for an organisation on the website");
        SendClientMessage(playerid,LRED,"Once you're in an organisation you will start making money, meaning you can buy cars, houses & businesses");
        SendClientMessage(playerid,LRED,"IMPORTANT! IF TIME IS GOING REALLY FAST, RESTART YOUR GAME! (Make sure you have read all of this!!)");
    }
    ClearAnimations(playerid);
    TAFK[playerid]=gettime()+300;
    TextDrawShowForPlayer(playerid,Textdraw1);
    TextDrawShowForPlayer(playerid,Textdraw2);
    TextDrawShowForPlayer(playerid,Textdraw3);
    TextDrawShowForPlayer(playerid,Textdraw4);
    TextDrawShowForPlayer(playerid,Textdraw5);
    TextDrawShowForPlayer(playerid,Zones[playerid]);
    VehicleBoost[playerid] = 0;
    return 1;
}
Player leaving
pawn Код:
public OnPlayerDisconnect(playerid,reason)
{
    new string[50];
    switch(reason)
    {
        case 0:
        {
            format(string,50,"*%s has left the server(Timeout)",PlayerName(playerid));
            SendClientMessageToAll(GREY,string);
            format(string,50,"~r~<~w~T-out~r~>~w~ %s",PlayerName(playerid));
            ConnectTextdraw(string);
        }
        case 1:
        {
            format(string,50,"*%s has left the server",PlayerName(playerid));
            SendClientMessageToAll(GREY,string);
            format(string,50,"~r~<~w~Left~r~>~w~ %s",PlayerName(playerid));
            ConnectTextdraw(string);
        }
    }
    if(IsBeingSpeced[playerid]==1)
    {
        for(new i=0;i<MAX_PLAYERS;i++)
        {
            if(IsPlayerConnectedEx(i)&&spectatorid[i]==playerid)
            {
                IsSpecing[i]=0;
                spectatorid[i]=0;
                SetPlayerInterior(i,Inter[i]);
                TogglePlayerSpectating(i,0);
                SetPlayerPos(i,pX[i],pY[i],pZ[i]);
                SendClientMessage(i,-1,"The player left,you aren't spectating him anymore");
            }
        }
    }
    SStats(playerid);
    IsLogged[playerid]=0;
    Delete3DTextLabel(Label[playerid]);
    DestroyVehicle(Licence[playerid][Vehicle]);
    if(Car[playerid]==1){DestroyVehicle(Car[playerid]);}
    if(Car2[playerid]==2){DestroyVehicle(Car2[playerid]);}
    if(Car3[playerid]==3){DestroyVehicle(Car3[playerid]);}
    if(Car4[playerid]==4){DestroyVehicle(Car4[playerid]);}
    if(Car5[playerid]==5){DestroyVehicle(Car5[playerid]);}
    if(Plane[playerid]>0){DestroyVehicle(Plane[playerid]);}
    if(ACar[playerid]>0){DestroyVehicle(ACar[playerid]);}
    VehicleBoost[playerid] = 0;
    return 1;
}
P.S. If anyone is able to go on Skype and help me with a few more bugs I'd really appreciate it
Reply
#2

Try using CreateVehicle instead of AddStaticVehicleEx. When the test is finished, you can easily remove it with DestroyVehicle.
Reply
#3

Ahh okay. I've already got DestroyVehicle enabled as well so hopefully that will fix it. I'll test now and get back to you!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)