Jump to content
  • 0

Ajut cu o comanda


TheRive

Question

Ma chinui de o zi sa fac o comanda gen "/infernus" si  sa se spawneze un vehicul.

Am facut aceasta comanda :

Quote

CMD:premier(playerid, params[])
{
    if (IsPlayerInRangeOfPoint(playerid,20.0,2820.0393,1319.7740,10.7577))
    {
    new Float:pos[4];
    GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
    GetPlayerFacingAngle(playerid, pos[3]);
   GetPlayerVehicleID(426, pos[0], pos[1], pos[2], pos[3], 1, 1, 1200);GetPlayerVehicleID()
    PutPlayerInVehicle(playerid, 91, 0);
    }
    return 1;
}

Dar nu e ceea ce-mi doresc . Am incercat sa pun ca dupa 2 minute dupa ce ai iesit din masina sa se distruga nu mi-a mers , doar respawn sau isi dadea destroy fix cand foloseam comanda.

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0
CMD:premier(playerid, params[])
{
    if (IsPlayerInRangeOfPoint(playerid,20.0,2820.0393,1319.7740,10.7577))
    {
         new Float:pos[4];
         GetPlayerPos(playerid, pos[0], pos[1], pos[2]); GetPlayerFacingAngle(playerid, pos[3]);
         new car = AddStaticVehicleEx (426, pos[0], pos[1], pos[2], pos[3], -1, -1, 30);
         PutPlayerInVehicle(playerid, car, 0);
    }
    return 1;
}

Incearca asa.

Link to comment
Share on other sites

  • 0

Greseala mea nu am citit bine ce ai scris.

#define INFERNUS 	411
#define TIMER 		2*60 // 2 minute
  
new PlayerVehicle[MAX_PLAYERS] = INVALID_VEHICLE_ID,
	DestroyTimer = -1,
	StartTimer = -1;


public OnPlayerConnect(playerid) {
    PlayerVehicle[playerid] = INVALID_VEHICLE_ID;
    DeletePVar(playerid, "EnterVehicle");
    DeletePVar(playerid, "PlayerRentVeh");
    return 1;
}

public OnPlayerDisconnect(playerid, reason) {
    DeletePVar(playerid, "EnterVehicle");
    DeletePVar(playerid, "PlayerRentVeh");
	return 1;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(PlayerVehicle[playerid] == vehicleid && !GetPVarInt(playerid, "EnterVehicle")) {
  	    SetPVarInt(playerid, "EnterVehicle", 1);
    } else if(PlayerVehicle[playerid] == vehicleid && GetPVarInt(playerid, "EnterVehicle") == 0) {
    	KillTimer(StartTimer);
    }
	return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
    if(PlayerVehicle[playerid] == vehicleid && GetPVarInt(playerid, "EnterVehicle") == 1) {
  	    SetPVarInt(playerid, "EnterVehicle", 0);
        StartTimer = SetTimerEx("DestroyVehicle", 1000, true, "d", playerid);
    }
	return 1;
}

forward DestroyVehicle(playerid);
public DestroyVehicle(playerid) {
	if(GetPVarInt(playerid, "EnterVehicle") != 1 && PlayerVehicle[playerid] != INVALID_VEHICLE_ID) {
    	DestroyTimer ++;
        if(DestroyTimer == TIMER) {
        	SendClientMessage(GetPVarInt(playerid, "PlayerRentVeh"), -1, "Vehiculul tau a fost distrus.");
        }
    }
  	return 1;
}

CMD:infernus(playerid, params[]) {
	if(IsPlayerConnected(playerid) && IsPlayerInRangeOfPoint(playerid, 20.0, x, y, z)) {
    	new Float: pos[4], car;
    	GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
      	GetPlayerFacingAngle(playerid, pos[3]);
        car = AddStaticVehicleEx(INFERNUS, pos[0], pos[1], pos[2], pos[3], -1, -1, 30);
        PutPlayerInVehicle(playerid, car, 0);
      	SetPVarInt(playerid, "PlayerRentVeh", playerid);
    }
	return 1;
}

 

Edited by BuNiCu-RP
Link to comment
Share on other sites

  • 0

new inf[MAX_PLAYERS], timerinf2[MAX_PLAYERS],  ix, iy, iz;

forward timerinf(playerid);

 

CMD:infernus(playerid)

{

    GetPlayerPos(playerid, ix, iy, iz) ;

    inf[playerid] = CreateVehicle(411, ix, iy, iz);

    PutPlayerInVehicle(playerid, inf[playerid], 0) 

    return 1;

}

La OnPlayerExitVehicle pui:

if(vehicleid == inf[playerid]) 

{

timerinf2[playerid] = SetTimerEx("timerinf", 120000, false, "i", playerid) ;

 

Apoi adăugăm:

public timerinf(playerid) {

DestroyCar(inf[playerid]) ;

return 1 ;

La OnPlayerEnterVehicle 

if(vehicleid == inf[playerid]) {

KillTimer(timerinf2[playerid]) ;

Edited by ASGOOD

maxresdefault.jpg

 

 

 

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.