Streamer problem
#1

So I made a job system a long time ago and haven't tested it until a few days ago.

The problem is that when somebody starts a job he gets a checkpoint and when someone else starts the same job the checkpoint for the first player gets deleted and created for the second player.

Why is this happening?

Код:
CMD:deliverwood(playerid, params[]) //This is the resized version of the script, I basically deleted everything you don't need to see.
{
    SetPlayerPosaoCP(playerid, 990.8340, -66.3616, 78.4627, 3.0);
    return 1;
}

stock SetPlayerPosaoCP(playerid, Float:X, Float:Y, Float:Z, Float:size)
{
    if(IsValidDynamicCP(PosaoCP[playerid]))
    {
	DestroyDynamicCP(PosaoCP[playerid]);
    }
    PosaoCP[playerid] = CreateDynamicCP(X, Y, Z, size, -1, -1, playerid);
    return 1;
}

public OnPlayerConnect(playerid)
{
    PosaoCP[playerid] = -1;
    return 1;
}
Reply
#2

try this

PHP код:
stock SetPlayerPosaoCP(playeridFloat:XFloat:YFloat:ZFloat:size)
{
    if(
PosaoCP[playerid])
    {
    
DestroyDynamicCP(PosaoCP[playerid]);
    }
    
PosaoCP[playerid] = CreateDynamicCP(XYZsize, -1, -1playerid);
    return 
1;

Reply
#3

Yeah it works, thanks
Reply
#4

That still won't work right! What happens if the checkpoint id is 0?

This fails!
Код:
if(PosaoCP[playerid])
When creating your variable do this.

Код:
PosaoCP[MAX_PLAYERS] = { -1, ... };
Then

Код:
SetPlayerPosaoCP(playerid, Float:X, Float:Y, Float:Z, Float:size)
{
    if(PosaoCP[playerid] > -1)
    {
	DestroyDynamicCP(PosaoCP[playerid]);
        PosaoCP[playerid] = -1;
    }
    PosaoCP[playerid] = CreateDynamicCP(X, Y, Z, size, -1, -1, playerid);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)