Hi, hab ein kleines "Problem". Ich möchte den Spieler Checkpoints anzeigen lassen, und das immer zufällig, mein Problem dabei ist das die immer nach der Reihenfolge nach erstellt werden, sobald ich sie betrete..
So sieht mein Script aktuell aus:
Die CP Spawns
new zaehler;
new Float:RandomCheckPoints[][3] =
{
{345.0795,2409.4045,16.4766}, // CP1
{303.6277,2452.1929,16.4766}, // CP2
{283.8078,2399.7253,16.4766}, // CP3
{237.8153,2414.4353,16.4829}, // CP4
{214.4529,2448.4434,16.4844}, // CP5
{188.6520,2402.8835,16.4844}, // CP6
{157.3420,2434.5330,16.4717}, // CP7
{116.9716,2391.2756,16.4844}, // CP8
{90.5075,2407.2466,16.4844}, // CP9
{104.7031,2468.0762,16.4766} // CP10
};
Der Befehl
CMD:cpjail(playerid,params[])
{
new pID, tmp[20], idx;
tmp = strtok(params, idx);
if(isnull(params)) return SendClientMessage(playerid,-1,"{FF0000}ERROR: /cpjail [ID]");
if(IsNumeric(tmp)) pID = strval(tmp);
else pID = ReturnPlayerID(tmp);
if(!IsPlayerConnected(pID)) return SendClientMessage(playerid,-1,"{FF0000}The Player is not online");
DisablePlayerCheckpoint(pID);
SetPlayerPos(pID, 363.1419,2385.1494,17.0377);
SetPlayerVirtualWorld(pID, 77);
SetPlayerFacingAngle(pID, 57.9134);
SetPlayerHealth(pID,99);
SetPlayerCheckpoint(pID, RandomCheckPoints[zaehler][0], RandomCheckPoints[zaehler][1], RandomCheckPoints[zaehler][2],1.5);
if(zaehler >= sizeof(RandomCheckPoints)) zaehler = 0;
zaehler++;
return 1;
}
Public
public OnPlayerEnterCheckpoint(playerid)
{
DisablePlayerCheckpoint(playerid);
if(zaehler >= sizeof(RandomCheckPoints)) zaehler = 0;
SetPlayerCheckpoint(playerid, RandomCheckPoints[zaehler][0], RandomCheckPoints[zaehler][1], RandomCheckPoints[zaehler][2],1.5);
zaehler++;
SendClientMessage(playerid,-1,"Checkpoint entered");
return 1;
}