Random checkpoints problem
#1

Yo guys, I have a problem with my new job "Grass Cutter".

So when I type /kositravu everything works fine for the first CP, but the second doesn't work for some reason...

Here is the code:

Код:
new Kosac[6];
new uKosenju[MAX_PLAYERS];
new kosenje[MAX_PLAYERS];
new Text3D:Kosaci3D;
new kosaco[MAX_PLAYERS];
new Float:PosaoCP[MAX_PLAYERS][4];


CMD:kositravu(playerid, params[])
{
    if(pInfo[playerid][pLogged] != 1) return SCM(playerid, COLOR_RED, "Niste logovani!");
	if(pInfo[playerid][pPosao] != KosacTrave) return SCM(playerid, COLOR_RED, "Greska!Niste zaposleni kao kosac trave!");
	new vehid = GetPlayerVehicleID(playerid);

	if(vehid >= Kosac[1] && vehid <= Kosac[5])
	{
	    if(uKosenju[playerid] == 1) return SCM(playerid, COLOR_OLIVE, "Vec kosite travu!");
	    else
	    {
	        uKosenju[playerid] = 1;
	        SCM(playerid, COLOR_LIGHTBLUE, "Zapoceli ste sa kosenjem trave!Pratite crvene markere");
			kosenje[playerid] = 1;
	 		new engine, lights, alarm, doors, bonnet, boot, objective;
			GetVehicleParamsEx(vehid, engine, lights, alarm, doors, bonnet, boot, objective);
			SetVehicleParamsEx(vehid, 1, lights, alarm, doors, bonnet, boot, objective);
			new rand = random(sizeof(KosacCP));
			
			SetPlayerCheckpoint(playerid, KosacCP[rand][0], KosacCP[rand][1], KosacCP[rand][2], 3);
			//CPX[playerid] = KosacCP[rand][0];
			//CPY[playerid] = KosacCP[rand][1];
			//CPZ[playerid] = KosacCP[rand][2];
			PosaoCP[playerid][1] = KosacCP[rand][0];
			PosaoCP[playerid][2] = KosacCP[rand][1];
			PosaoCP[playerid][3] = KosacCP[rand][2];
			kosaco[playerid] = rand;
	    }
	    return 1;
	}
	return 1;
}
and OnPlayerEnterCheckpoint:

Код:
	else if(vehid == Kosac[1] || vehid == Kosac[2] || vehid == Kosac[3] || vehid == Kosac[4] || vehid == Kosac[5])
	{
	    if(IPP(playerid, 15.0, PosaoCP[playerid][1], PosaoCP[playerid][2], PosaoCP[playerid][3]))
		{
	        if(kosenje[playerid] == 1)
	        {
				DisablePlayerCheckpoint(playerid);
				kosenje[playerid] = 2;
				new rand, Float:x, Float:y, Float:z;
				rand = (1+kosaco[playerid]+random(sizeof(KosacCP)-1))%sizeof(KosacCP);
				x = KosacCP[rand][0];
				y = KosacCP[rand][1];
				z = KosacCP[rand][2];

				SetPlayerCheckpoint(playerid, x, y, z, 3);
				PosaoCP[playerid][1] = x;
				PosaoCP[playerid][2] = y;
				PosaoCP[playerid][3] = z;
				kosaco[playerid] = rand;
				GameTextForPlayer(playerid, "~W~1~Y~/10", 100, 1);
	            return 1;
	        }
	        return 1;
	    }
	    if(IPP(playerid, 15.0, PosaoCP[playerid][1], PosaoCP[playerid][2], PosaoCP[playerid][3]))
	    {
	        if(kosenje[playerid] == 2)
	        {
				DisablePlayerCheckpoint(playerid);
				kosenje[playerid] = 3;
				new rand, Float:x, Float:y, Float:z;
				rand = (1+kosaco[playerid]+random(sizeof(KosacCP)-1))%sizeof(KosacCP);
				x = KosacCP[rand][0];
				y = KosacCP[rand][1];
				z = KosacCP[rand][2];

				SetPlayerCheckpoint(playerid, x, y, z, 3);
				PosaoCP[playerid][1] = x;
				PosaoCP[playerid][2] = y;
				PosaoCP[playerid][3] = z;
				kosaco[playerid] = rand;
				GameTextForPlayer(playerid, "~W~2~Y~/10", 100, 1);
	            return 1;
	        }
	        return 1;
	    }
Can anyone help me? Thanks in advice...
Reply
#2

Nobody?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)