Jump to content
  • 0

Comanda utilizata doar in anumite vehicule


Guest Alxxie

Question

Cum fac o comanda care poate fi utilizata doar in anumite vehicule(mai multe).

Sa presupunem ca am 60 de vehicule in care vreau sa poata fi utilizata o comanda.Cum fac? ???

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

Guest Mariachi

Faci asa :

forward IsASpecialCar(carid);
public IsASpecialCar(carid)
{
	if((carid >= 169) && (carid <= 171))
	{
	    return 1;
	}
	return 0;
}
Si comanda trebuie sa fie asa
    if(!strcmp(cmdtext, "/comanda", true)) // By LordMan
    {
		if(IsPlayerConnected(playerid))
		{
		    new carid = GetPlayerVehicleID(playerid);
		    if(IsASpecialCar(carid))
		    {

		    }
		}
		return 1;
    }

Link to comment
Share on other sites

varianta GF, dar daca futi "locul" vehiculeleor in GamemodeInit se fute tot.

poti sa faci

new Vehs[60];

//sub gamemodeinit
Vehs[0] = 
Vehs[1] =
Vehs[2] = 
Vehs[3] =
etc.

//sub commandtext
    if(!strcmp(cmdtext, "/comanda", true)) // By LordMan
    {
        new carid = GetPlayerVehicleID(playerid);
        for(new i=0; i<60; i++)
        {
            if( carid == Vehs[i] )
            {
                //comanda ta
            }
        }
        return 1;
    }
Sau cu functie

stock IsASpecialCar(carid)
{
    for(new i=0; i<60; i++)
    {
        if( carid == Vehs[i] )
        {
            return 1;
        }
    }
    return 0;
}

//comanda
    if(!strcmp(cmdtext, "/comanda", true)) // By LordMan
    {
        new carid = GetPlayerVehicleID(playerid);
        if( IsASpecialCar(carid) )
        {
                //comanda
        }                    
        return 1;
    }

Spre deosebire de Moz asta garanteaza functionarea oricand, daca faci ca Moz, tot merge, dar daca schimbi locul vehiculelor in GameModeInit, se strica tot. Acum faci cu vrei tu.

Bafta

-Toate tutorialele postate intra aici sau puneti-le direct [url=http://www.sa-mp.ro/forum/index

Link to comment
Share on other sites

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.