Jump to content
  • 0

/findcar


ToX1c

Question

Nick: ToX1c

Problema:Salut cum as putea face si eu la comanda /findcar daca este un checkpoint pe mapa sa nu pot sa dau

Lini/script:

CMD:findcar(playerid, params[])
{
if(sweep[playerid] == 1)
{
SendClientMessage(playerid, COLOR_GREY, SYNTAX_MESSAGE" Nu poti folosi acum aceasta comanda");
return 1;
}
   new carslot;
    if(sscanf(params, "d", carslot)) return SendClientMessage(playerid, COLOR_GREY, SYNTAX_MESSAGE"/findcar [1/2/3/4]");
    {
    if(CP[playerid] == 0)
    {
        if(playerVariables[playerid][pCarModel1] >= 1 || playerVariables[playerid][pCarModel2] >= 1 || playerVariables[playerid][pCarModel3] >= 1 || playerVariables[playerid][pCarModel4] >= 1)
        {
            if(carslot == 1)
            {
                GetVehiclePos(playerVariables[playerid][pCarID1], playerVariables[playerid][pCarPos1][0], playerVariables[playerid][pCarPos1][1], playerVariables[playerid][pCarPos1][2]);
                SetPlayerCheckpoint(playerid, playerVariables[playerid][pCarPos1][0], playerVariables[playerid][pCarPos1][1], playerVariables[playerid][pCarPos1][2], 10.0);
                playerVariables[playerid][pCheckpoint] = 4;
                format(szMessage, sizeof(szMessage), "A checkpoint has been set to your %s.", VehicleNames[playerVariables[playerid][pCarModel1] - 400]);
                SendClientMessage(playerid, COLOR_WHITE, szMessage);
            }
            else if(carslot == 2)
            {
                GetVehiclePos(playerVariables[playerid][pCarID2], playerVariables[playerid][pCarPos2][0], playerVariables[playerid][pCarPos2][1], playerVariables[playerid][pCarPos2][2]);
                SetPlayerCheckpoint(playerid, playerVariables[playerid][pCarPos2][0], playerVariables[playerid][pCarPos2][1], playerVariables[playerid][pCarPos2][2], 10.0);
                playerVariables[playerid][pCheckpoint] = 4;
                format(szMessage, sizeof(szMessage), "A checkpoint has been set to your %s.", VehicleNames[playerVariables[playerid][pCarModel2] - 400]);
                SendClientMessage(playerid, COLOR_WHITE, szMessage);
            }
            else if(carslot == 3)
            {
                GetVehiclePos(playerVariables[playerid][pCarID3], playerVariables[playerid][pCarPos3][0], playerVariables[playerid][pCarPos3][1], playerVariables[playerid][pCarPos3][2]);
                SetPlayerCheckpoint(playerid, playerVariables[playerid][pCarPos3][0], playerVariables[playerid][pCarPos3][1], playerVariables[playerid][pCarPos3][2], 10.0);
                playerVariables[playerid][pCheckpoint] = 4;
                format(szMessage, sizeof(szMessage), "A checkpoint has been set to your %s.", VehicleNames[playerVariables[playerid][pCarModel3] - 400]);
                SendClientMessage(playerid, COLOR_WHITE, szMessage);
            }
            else if(carslot == 4)
            {
                GetVehiclePos(playerVariables[playerid][pCarID4], playerVariables[playerid][pCarPos4][0], playerVariables[playerid][pCarPos4][1], playerVariables[playerid][pCarPos4][2]);
                SetPlayerCheckpoint(playerid, playerVariables[playerid][pCarPos4][0], playerVariables[playerid][pCarPos4][1], playerVariables[playerid][pCarPos4][2], 10.0);
                playerVariables[playerid][pCheckpoint] = 4;
                format(szMessage, sizeof(szMessage), "A checkpoint has been set to your %s.", VehicleNames[playerVariables[playerid][pCarModel4] - 400]);
                SendClientMessage(playerid, COLOR_WHITE, szMessage);
           }
            }
            else SendClientMessage(playerid, COLOR_GREY, "Invalid car slot id.");
        }
        else SendClientMessage(playerid, COLOR_GREY, "You don't own a vehicle.");
    }
    SendClientMessage(playerid, COLOR_GREY, "Foloseste /killcp pentru a folosi comanda !");
    return 1;
}

Ai incercat sa rezolvi singur ?: Am incercat eu sa fac da nu merge imi apare asa

http://tinypic.com/view.php?pic=1597jp&s=8#.U2QUZoF_sQl

Link to comment
Share on other sites

16 answers to this question

Recommended Posts

Depinde de ce variabila folosesti tu pentru a creea un checkpoint de exemplu daca peste tot in gm ai doar variabila CP atunci poti sa pui o conditie ca daca CP este mai mare de 1 playerul sa nu poata da /findcar si sa-i apara un sendclientmessage . Daca tu ai mai multe variabile pentru a creea checkpointuri de exemplu ai CP si CP2 atunci la conditie vei folosi || care inseamna sau adica daca CP este mai mare de 1 sau CP2 este mai mare decat unu ii va da o eroare .

Link to comment
Share on other sites

incearca sa pui dupa fiecare if(cp[playerid] == ...) de la OnPlayerEnterCheckPoint, unde e DisablePlayerCheckpoint pui CP[playerid] = 0;

Nu mai deschideti in pu*a mea servere de SA:MP !

Jucati-va pe cele care sunt !   Sunt suficiente !

Reguli de bun simt:

1. Nu faceti reclama unde nu trebuie !

2. Nu injurati ca la usa cortului !

3. Daca esti analfabeti, taci din gura !

4. Nu abuza de 'scuze', 'din greseala' !

 

My work ::: http://pastebin.com/VRNRcaAs

Link to comment
Share on other sites

Am facut ceva de genu da imi apare 2 mesaje..

CMD:findcar(playerid, params[])
{
    new carslot;
	if(sscanf(params, "d", carslot)) return SendClientMessage(playerid, COLOR_GREY, SYNTAX_MESSAGE"/findcar [1/2/3/4]");
	{
	if(CP[playerid] == 0)
	{
		if(playerVariables[playerid][pCarModel1] >= 1 || playerVariables[playerid][pCarModel2] >= 1 || playerVariables[playerid][pCarModel3] >= 1 || playerVariables[playerid][pCarModel4] >= 1)
		{
		    if(carslot == 1)
		    {
				GetVehiclePos(playerVariables[playerid][pCarID1], playerVariables[playerid][pCarPos1][0], playerVariables[playerid][pCarPos1][1], playerVariables[playerid][pCarPos1][2]);
				SetPlayerCheckpoint(playerid, playerVariables[playerid][pCarPos1][0], playerVariables[playerid][pCarPos1][1], playerVariables[playerid][pCarPos1][2], 10.0);
				playerVariables[playerid][pCheckpoint] = 4;
				format(szMessage, sizeof(szMessage), "A checkpoint has been set to your %s.", VehicleNames[playerVariables[playerid][pCarModel1] - 400]);
				SendClientMessage(playerid, COLOR_WHITE, szMessage);
			}
			else if(carslot == 2)
			{
			    GetVehiclePos(playerVariables[playerid][pCarID2], playerVariables[playerid][pCarPos2][0], playerVariables[playerid][pCarPos2][1], playerVariables[playerid][pCarPos2][2]);
				SetPlayerCheckpoint(playerid, playerVariables[playerid][pCarPos2][0], playerVariables[playerid][pCarPos2][1], playerVariables[playerid][pCarPos2][2], 10.0);
				playerVariables[playerid][pCheckpoint] = 4;
				format(szMessage, sizeof(szMessage), "A checkpoint has been set to your %s.", VehicleNames[playerVariables[playerid][pCarModel2] - 400]);
				SendClientMessage(playerid, COLOR_WHITE, szMessage);
			}
			else if(carslot == 3)
			{
			    GetVehiclePos(playerVariables[playerid][pCarID3], playerVariables[playerid][pCarPos3][0], playerVariables[playerid][pCarPos3][1], playerVariables[playerid][pCarPos3][2]);
				SetPlayerCheckpoint(playerid, playerVariables[playerid][pCarPos3][0], playerVariables[playerid][pCarPos3][1], playerVariables[playerid][pCarPos3][2], 10.0);
				playerVariables[playerid][pCheckpoint] = 4;
				format(szMessage, sizeof(szMessage), "A checkpoint has been set to your %s.", VehicleNames[playerVariables[playerid][pCarModel3] - 400]);
				SendClientMessage(playerid, COLOR_WHITE, szMessage);
			}
			else if(carslot == 4)
			{
			    GetVehiclePos(playerVariables[playerid][pCarID4], playerVariables[playerid][pCarPos4][0], playerVariables[playerid][pCarPos4][1], playerVariables[playerid][pCarPos4][2]);
				SetPlayerCheckpoint(playerid, playerVariables[playerid][pCarPos4][0], playerVariables[playerid][pCarPos4][1], playerVariables[playerid][pCarPos4][2], 10.0);
				playerVariables[playerid][pCheckpoint] = 4;
				format(szMessage, sizeof(szMessage), "A checkpoint has been set to your %s.", VehicleNames[playerVariables[playerid][pCarModel4] - 400]);
				SendClientMessage(playerid, COLOR_WHITE, szMessage);
           }
			}
			else SendClientMessage(playerid, COLOR_GREY, "Invalid car slot id.");
		}
		else SendClientMessage(playerid, COLOR_GREY, "You don't own a vehicle.");
	}
	SendClientMessage(playerid, COLOR_GREY, "Foloseste /killcp pentru a folosi comanda !");
	return 1;
}

http://tinypic.com/view.php?pic=1597jp&s=8#.U2QUZoF_sQl

Link to comment
Share on other sites

CMD:findcar(playerid, params[])
{
    new carslot;

	if(sweep[playerid] == 1)
		return SendClientMessage(playerid, COLOR_GREY, " Nu poti folosi acum aceasta comanda");

	if(sscanf(params, "d", carslot))
		return SendClientMessage(playerid, COLOR_GREY, "/findcar [1/2/3/4]");

	if(CP[playerid] >= 1 || playerVariables[playerid][pCheckpoint] >= 1)
	    return SendClientMessage(playerid, COLOR_GREY, "Foloseste /killcp pentru a folosi comanda !");

	if(playerVariables[playerid][pCarModel1] < 1 || playerVariables[playerid][pCarModel2] < 1 || playerVariables[playerid][pCarModel3] < 1 || playerVariables[playerid][pCarModel4] < 1)
        return SendClientMessage(playerid, COLOR_GREY, "You don't own a vehicle.");

	if(carslot > 4)
	    return SendClientMessage(playerid, COLOR_GREY, "Invalid car slot id.");
	    
	switch( carslot )
	{
	    case 1:
	    {
			GetVehiclePos(playerVariables[playerid][pCarID1], playerVariables[playerid][pCarPos1][0], playerVariables[playerid][pCarPos1][1], playerVariables[playerid][pCarPos1][2]);
			SetPlayerCheckpoint(playerid, playerVariables[playerid][pCarPos1][0], playerVariables[playerid][pCarPos1][1], playerVariables[playerid][pCarPos1][2], 10.0);
			playerVariables[playerid][pCheckpoint] = 4;
			format(szMessage, sizeof(szMessage), "A checkpoint has been set to your %s.", VehicleNames[playerVariables[playerid][pCarModel1] - 400]);
			SendClientMessage(playerid, COLOR_WHITE, szMessage);
	    }
	    case 2:
	    {
			GetVehiclePos(playerVariables[playerid][pCarID2], playerVariables[playerid][pCarPos2][0], playerVariables[playerid][pCarPos2][1], playerVariables[playerid][pCarPos2][2]);
			SetPlayerCheckpoint(playerid, playerVariables[playerid][pCarPos2][0], playerVariables[playerid][pCarPos2][1], playerVariables[playerid][pCarPos2][2], 10.0);
			playerVariables[playerid][pCheckpoint] = 4;
			format(szMessage, sizeof(szMessage), "A checkpoint has been set to your %s.", VehicleNames[playerVariables[playerid][pCarModel2] - 400]);
			SendClientMessage(playerid, COLOR_WHITE, szMessage);
	    }
	    case 3:
	    {
			GetVehiclePos(playerVariables[playerid][pCarID3], playerVariables[playerid][pCarPos3][0], playerVariables[playerid][pCarPos3][1], playerVariables[playerid][pCarPos3][2]);
			SetPlayerCheckpoint(playerid, playerVariables[playerid][pCarPos3][0], playerVariables[playerid][pCarPos3][1], playerVariables[playerid][pCarPos3][2], 10.0);
			playerVariables[playerid][pCheckpoint] = 4;
			format(szMessage, sizeof(szMessage), "A checkpoint has been set to your %s.", VehicleNames[playerVariables[playerid][pCarModel3] - 400]);
			SendClientMessage(playerid, COLOR_WHITE, szMessage);
	    }
		case 4:
		{
			GetVehiclePos(playerVariables[playerid][pCarID4], playerVariables[playerid][pCarPos4][0], playerVariables[playerid][pCarPos4][1], playerVariables[playerid][pCarPos4][2]);
			SetPlayerCheckpoint(playerid, playerVariables[playerid][pCarPos4][0], playerVariables[playerid][pCarPos4][1], playerVariables[playerid][pCarPos4][2], 10.0);
			playerVariables[playerid][pCheckpoint] = 4;
			format(szMessage, sizeof(szMessage), "A checkpoint has been set to your %s.", VehicleNames[playerVariables[playerid][pCarModel4] - 400]);
			SendClientMessage(playerid, COLOR_WHITE, szMessage);
		}
	}
    return 1;
}

Daca nu-ti merge nici asta posteaza OnPlayerEnterCheckpoint si OnPlayerEnterRaceCheckpoint ( daca il ai ) .

Link to comment
Share on other sites

Incearca asta daca nu merge astept raspuns .

CMD:findcar(playerid, params[])
{
if(sweep[playerid] == 1)
{
SendClientMessage(playerid, COLOR_GREY, SYNTAX_MESSAGE" Nu poti folosi acum aceasta comanda");
return 1;
}
   new carslot;
    if(sscanf(params, "d", carslot)) return SendClientMessage(playerid, COLOR_GREY, SYNTAX_MESSAGE"/findcar [1/2/3/4]");
    {
    if(CP[playerid] == 0 || CPR[playerid] == 0)
    {
        if(playerVariables[playerid][pCarModel1] >= 1 || playerVariables[playerid][pCarModel2] >= 1 || playerVariables[playerid][pCarModel3] >= 1 || playerVariables[playerid][pCarModel4] >= 1)
        {
            if(carslot == 1)
            {
                GetVehiclePos(playerVariables[playerid][pCarID1], playerVariables[playerid][pCarPos1][0], playerVariables[playerid][pCarPos1][1], playerVariables[playerid][pCarPos1][2]);
                SetPlayerCheckpoint(playerid, playerVariables[playerid][pCarPos1][0], playerVariables[playerid][pCarPos1][1], playerVariables[playerid][pCarPos1][2], 10.0);
                playerVariables[playerid][pCheckpoint] = 4;
                format(szMessage, sizeof(szMessage), "A checkpoint has been set to your %s.", VehicleNames[playerVariables[playerid][pCarModel1] - 400]);
                SendClientMessage(playerid, COLOR_WHITE, szMessage);
            }
            else if(carslot == 2)
            {
                GetVehiclePos(playerVariables[playerid][pCarID2], playerVariables[playerid][pCarPos2][0], playerVariables[playerid][pCarPos2][1], playerVariables[playerid][pCarPos2][2]);
                SetPlayerCheckpoint(playerid, playerVariables[playerid][pCarPos2][0], playerVariables[playerid][pCarPos2][1], playerVariables[playerid][pCarPos2][2], 10.0);
                playerVariables[playerid][pCheckpoint] = 4;
                format(szMessage, sizeof(szMessage), "A checkpoint has been set to your %s.", VehicleNames[playerVariables[playerid][pCarModel2] - 400]);
                SendClientMessage(playerid, COLOR_WHITE, szMessage);
            }
            else if(carslot == 3)
            {
                GetVehiclePos(playerVariables[playerid][pCarID3], playerVariables[playerid][pCarPos3][0], playerVariables[playerid][pCarPos3][1], playerVariables[playerid][pCarPos3][2]);
                SetPlayerCheckpoint(playerid, playerVariables[playerid][pCarPos3][0], playerVariables[playerid][pCarPos3][1], playerVariables[playerid][pCarPos3][2], 10.0);
                playerVariables[playerid][pCheckpoint] = 4;
                format(szMessage, sizeof(szMessage), "A checkpoint has been set to your %s.", VehicleNames[playerVariables[playerid][pCarModel3] - 400]);
                SendClientMessage(playerid, COLOR_WHITE, szMessage);
            }
            else if(carslot == 4)
            {
                GetVehiclePos(playerVariables[playerid][pCarID4], playerVariables[playerid][pCarPos4][0], playerVariables[playerid][pCarPos4][1], playerVariables[playerid][pCarPos4][2]);
                SetPlayerCheckpoint(playerid, playerVariables[playerid][pCarPos4][0], playerVariables[playerid][pCarPos4][1], playerVariables[playerid][pCarPos4][2], 10.0);
                playerVariables[playerid][pCheckpoint] = 4;
                format(szMessage, sizeof(szMessage), "A checkpoint has been set to your %s.", VehicleNames[playerVariables[playerid][pCarModel4] - 400]);
                SendClientMessage(playerid, COLOR_WHITE, szMessage);
           }
            }
            else SendClientMessage(playerid, COLOR_GREY, "Invalid car slot id.");
        }
        else SendClientMessage(playerid, COLOR_GREY, "You don't own a vehicle.");
    }
	else SendClientMessage(playerid, COLOR_GREY, "Foloseste /killcp pentru a folosi comanda !");
    return 1;
}

Link to comment
Share on other sites

C:\Users\Desktop\sG\gamemodes\rp.pwn(13285) : error 029: invalid expression, assumed zero
Pawn compiler 3.2.3664	 	 	Copyright (c) 1997-2006, ITB CompuPhase


1 Error.
Linia
else SendClientMessage(playerid, COLOR_GREY, "Foloseste /killcp pentru a folosi comanda !");

Link to comment
Share on other sites

CMD:findcar(playerid, params[])
{
    new carslot;

    if(sweep[playerid] == 1)
        return SendClientMessage(playerid, COLOR_GREY, " Nu poti folosi acum aceasta comanda");

    if(sscanf(params, "d", carslot))
        return SendClientMessage(playerid, COLOR_GREY, "/findcar [1/2/3/4]");

    if(CP[playerid] >= 1 || CPR[playerid] >= 1 || playerVariables[playerid][pCheckpoint] >= 1)
        return SendClientMessage(playerid, COLOR_GREY, "Foloseste /killcp pentru a folosi comanda !");

    if(playerVariables[playerid][pCarModel1] < 1 || playerVariables[playerid][pCarModel2] < 1 || playerVariables[playerid][pCarModel3] < 1 || playerVariables[playerid][pCarModel4] < 1)
        return SendClientMessage(playerid, COLOR_GREY, "You don't own a vehicle.");

    if(carslot > 4)
        return SendClientMessage(playerid, COLOR_GREY, "Invalid car slot id.");

    switch( carslot )
    {
        case 1:
        {
            GetVehiclePos(playerVariables[playerid][pCarID1], playerVariables[playerid][pCarPos1][0], playerVariables[playerid][pCarPos1][1], playerVariables[playerid][pCarPos1][2]);
            SetPlayerCheckpoint(playerid, playerVariables[playerid][pCarPos1][0], playerVariables[playerid][pCarPos1][1], playerVariables[playerid][pCarPos1][2], 10.0);
            playerVariables[playerid][pCheckpoint] = 4;
            format(szMessage, sizeof(szMessage), "A checkpoint has been set to your %s.", VehicleNames[playerVariables[playerid][pCarModel1] - 400]);
            SendClientMessage(playerid, COLOR_WHITE, szMessage);
        }
        case 2:
        {
            GetVehiclePos(playerVariables[playerid][pCarID2], playerVariables[playerid][pCarPos2][0], playerVariables[playerid][pCarPos2][1], playerVariables[playerid][pCarPos2][2]);
            SetPlayerCheckpoint(playerid, playerVariables[playerid][pCarPos2][0], playerVariables[playerid][pCarPos2][1], playerVariables[playerid][pCarPos2][2], 10.0);
            playerVariables[playerid][pCheckpoint] = 4;
            format(szMessage, sizeof(szMessage), "A checkpoint has been set to your %s.", VehicleNames[playerVariables[playerid][pCarModel2] - 400]);
            SendClientMessage(playerid, COLOR_WHITE, szMessage);
        }
        case 3:
        {
            GetVehiclePos(playerVariables[playerid][pCarID3], playerVariables[playerid][pCarPos3][0], playerVariables[playerid][pCarPos3][1], playerVariables[playerid][pCarPos3][2]);
            SetPlayerCheckpoint(playerid, playerVariables[playerid][pCarPos3][0], playerVariables[playerid][pCarPos3][1], playerVariables[playerid][pCarPos3][2], 10.0);
            playerVariables[playerid][pCheckpoint] = 4;
            format(szMessage, sizeof(szMessage), "A checkpoint has been set to your %s.", VehicleNames[playerVariables[playerid][pCarModel3] - 400]);
            SendClientMessage(playerid, COLOR_WHITE, szMessage);
        }
        case 4:
        {
            GetVehiclePos(playerVariables[playerid][pCarID4], playerVariables[playerid][pCarPos4][0], playerVariables[playerid][pCarPos4][1], playerVariables[playerid][pCarPos4][2]);
            SetPlayerCheckpoint(playerid, playerVariables[playerid][pCarPos4][0], playerVariables[playerid][pCarPos4][1], playerVariables[playerid][pCarPos4][2], 10.0);
            playerVariables[playerid][pCheckpoint] = 4;
            format(szMessage, sizeof(szMessage), "A checkpoint has been set to your %s.", VehicleNames[playerVariables[playerid][pCarModel4] - 400]);
            SendClientMessage(playerid, COLOR_WHITE, szMessage);
        }
    }
    return 1;
}

Ar trebui sa-ti mearga ori si cum la comanda care o ai tu nu sunt bine puse sendclientmessae-urile cu else.

Link to comment
Share on other sites

Pune asta:

[pawn]if(playerVariables[playerid][pCarModel1] < 1 && playerVariables[playerid][pCarModel2] < 1 && playerVariables[playerid][pCarModel3] < 1 && playerVariables[playerid][pCarModel4] < 1)[/pawn]

inloc de [pawn]if(playerVariables[playerid][pCarModel1] < 1 || playerVariables[playerid][pCarModel2] < 1 || playerVariables[playerid][pCarModel3] < 1 || playerVariables[playerid][pCarModel4] < 1)[/pawn]

Link to comment
Share on other sites

Tot nu vrea sa mearga daca am un checkpoint pe mapa , daca dau prima data /findcar imi apare checkpointul si dupa dau iar imi apare mesajul sa dau /killcp , dar daca am alt checkpoint de la /jobs merge sa dau /findcar si imi dispare acel checkpoint de la /jobs si ma duce la masina

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • 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.