Streamer problem - 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: Streamer problem (
/showthread.php?tid=654766)
Streamer problem -
andrejc999 - 05.06.2018
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;
}
Re: Streamer problem -
IceBilizard - 05.06.2018
try this
PHP код:
stock SetPlayerPosaoCP(playerid, Float:X, Float:Y, Float:Z, Float:size)
{
if(PosaoCP[playerid])
{
DestroyDynamicCP(PosaoCP[playerid]);
}
PosaoCP[playerid] = CreateDynamicCP(X, Y, Z, size, -1, -1, playerid);
return 1;
}
Re: Streamer problem -
andrejc999 - 05.06.2018
Yeah it works, thanks
Re: Streamer problem -
Pottus - 05.06.2018
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;
}