streamer - DynamicCP
#5

Quote:
Originally Posted by justinnater
Посмотреть сообщение
First time you create the CP, you store the returned id from the function CreateDynamicCP into the variable 'CheckCarregar_TransportadorRefC[playerid]'
Lets just assume it is the first CP since server start created and stored into your variable.
Your variable 'CheckCarregar_TransportadorRefC[playerid]' is now containing the number '1'.

As when you create a second CP and store it in the other variable, the number would be 2.
BUT... You are deleting the first CP before creating the second CP, meaning that you just freed up slot 1 from the CP and the next CP created will be 1, meaning you are now getting a conflict on these two lines because they are equal:


because you are not ending your first code within the checker from 'if(checkpointid == CheckCarregar_TransportadorRefC[playerid]) ' with a 'return' this problem happens.

add a return 1; in each statement

Set the variable to 0 when deleted with destroydynamiccp
He shouldn't have more than one return anyways. Using return is a poor solution when it should be else if. Also those variables should be set to -1 to indicate invalid.

Код:
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
    if(checkpointid == CheckCarregar_TransportadorRefC[playerid])
    {
        if(IsPlayerInVehicleJob_01(playerid))
        {
            if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)))
            {
                DestroyDynamicCP(CheckCarregar_TransportadorRefC[playerid]);
				CheckCarregar_TransportadorRefC[playerid] = -1;
                RemovePlayerMapIcon(playerid, 0);
                SendClientMessage(playerid, -1, "loading.");

                CheckDes_TransportadorRefC[playerid] = CreateDynamicCP(264.9304,1388.5432,10.5859, 7.0, -1, -1, playerid, STREAMER_CP_SD, -1, 0);
                SetPlayerMapIcon(playerid, 0, 264.9304,1388.5432,10.5859, 0, 0xFF0000AA, 0);

            } else SendClientMessage(playerid, -1, "Vocк nгo estб com o trailer da sua profissгo engatado");
        } else SendClientMessage(playerid, -1, "Esse nгo й seu veiculo de trabalho");
    }
    else if(checkpointid == CheckDes_TransportadorRefC[playerid])
    {
        if(IsPlayerInVehicleJob_01(playerid))
        {
            if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)))
            {
                DestroyDynamicCP(CheckDes_TransportadorRefC[playerid]);
                CheckDes_TransportadorRefC[playerid] = -1;
                Player[playerid][pTrabalhando] = false;
                SendClientMessage(playerid, -1, "finished.");
                RemovePlayerMapIcon(playerid, 0);

            } else SendClientMessage(playerid, -1, "Vocк nгo estб com o trailer da sua profissгo engatado");
        } else SendClientMessage(playerid, -1, "Esse nгo й seu veiculo de trabalho");
    }
    return 1;
}
Reply


Messages In This Thread
streamer - DynamicCP - by Cauezin - 19.03.2019, 22:00
Re: streamer - DynamicCP - by justinnater - 21.03.2019, 01:03
Re: streamer - DynamicCP - by Cauezin - 21.03.2019, 18:33
Re: streamer - DynamicCP - by antixgaming - 22.03.2019, 19:06
Re: streamer - DynamicCP - by Pottus - 23.03.2019, 04:24

Forum Jump:


Users browsing this thread: 1 Guest(s)