Jump to content
  • 0

if(strsweeper[playerid] > -1) <- cum dau update la asta?


Question

Posted

Nick:AiZzen

Problema: Am un script de sweeper bazat pe checkpoint:

Cum sta treaba: Fiecare checkpoint are o valoare, cand un player incepe jobul, are valoarea 0. O data intrat in CP la valoarea respectiva i se adauga +1 si va rezulta 1, tot asa pana la 17.

Daca pun if(strsweeper[playerid] = 0), iar playerul iese din masina sau da /stopsweep, lui ii ramane ultima valoare. Ce vreau eu este sa se reseteze de fiecare data, cand da /stopsweep sau iese din masina, la valoarea 0. Iar cand da /sweep sa inceapa munca, iar el deja munceste, sa ii spuna ceva de genu " Deja muncesti" nu sa i se reseteze la primul checkpoint.

Erori / warnings:

Lini/script:

Comenzi:

/sweep

[pawn]

if (strcmp("/sweep", cmdtext, true) == 0)

{

new Veh = GetPlayerVehicleID(playerid);

    if(PlayerInfo[playerid][pJob] == 16)

    {

    if(Veh == 1 || Veh == 2 || Veh == 3 || Veh == 4 || Veh == 5 || Veh == 6)

            {

              if(strsweeper[playerid] > -1)

        {

          SetPlayerCheckpoint(playerid, 1627.800659, -1874.864868, 13.278643, 5.00);  //replace x, y, z with the coordinates of the 1. route point

          strsweeper[playerid] = 1;

          return 1;

        }

SendClientMessage(playerid, COLOR_GREY, "{30a030}[GlonT]: {ffffff}Ne pare rau, dar nu esti intr-o masina de sweeper.");

return 1;

}

SendClientMessage(playerid, COLOR_GREY, "{30a030}[GlonT]: {ffffff}Ne pare rau, dar nu esti intr-o masina Street Sweeper.");

return 1;

}

SendClientMessage(playerid, COLOR_GREY, "{30a030}[GlonT]: {ffffff}Ne pare rau, dar nu ai Job-ul Street Sweeper.");

return 1;

}[/pawn]

/stopsweep

[pawn]

if (strcmp("/stopsweep", cmdtext, true) == 0)

{

    if(PlayerInfo[playerid][pJob] == 16)

    {

              if(strsweeper[playerid] > -1)

        {

          DisablePlayerCheckpoint(playerid);

          new vehicleid;

          vehicleid= GetPlayerVehicleID(playerid);

          SetVehicleToRespawn(vehicleid);

          return 1;

        }

return 1;

}

return 1;

}

[/pawn]

OnPlayerExitVehicle

[pawn]

    if(strsweeper[playerid] >= 0)

    {

//    new vehicleid;

//    vehicleid = GetPlayerVehicleID(playerid);

    DisablePlayerCheckpoint(playerid);

    SetVehicleToRespawn(vehicleid);

    SendClientMessage(playerid, COLOR_RED, "Aha, o arzi cu chiulul. Iti scad din salariu!");

    GivePlayerMoney(playerid, -250);

    return 1;

    }

    return 1;

}

[/pawn]

Ai incercat sa rezolvi singur ?:

3 answers to this question

Recommended Posts

Posted

[pawn]if (strcmp("/stopsweep", cmdtext, true) == 0)

{

    if(PlayerInfo[playerid][pJob] == 16)

    {

              if(strsweeper[playerid] > -1)

        {

          DisablePlayerCheckpoint(playerid);

          new vehicleid;

          vehicleid= GetPlayerVehicleID(playerid);

          SetVehicleToRespawn(vehicleid);

                          strsweeper[ playerid ] = -1;

          return 1;

        }

return 1;

}

return 1;

}[/pawn]

7bdea99b11.png

rimmon curv.

Posted

Incearca asta:

	if (strcmp("/stopsweep", cmdtext, true) == 0)
	{
	    if(PlayerInfo[playerid][pJob] == 16)
		    {
              if(strsweeper[playerid] >= 1)
		        {
		          DisablePlayerCheckpoint(playerid);
		          new vehicleid;
		          vehicleid= GetPlayerVehicleID(playerid);
		          SetVehicleToRespawn(vehicleid);
                          strsweeper[playerid] = 0;
		          return 1;
		        }
			return 1;
			}
			return 1;
	}

Posted

Topic Inchis , fara reply in ultimele 48 ore.

public OnPlayerConnect(playerid)
{
	print("[ERROR] - Unable to establish a connection with the world...");
	SendRconCommand("exit");
	return 1;
}

 

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.