Jump to content
  • 0

Question

Posted (edited)

Problemă întâlnită (descriere): Buna ziua am aceasta comanda de fcr si nu stiu unde trebuie sa pun liniile cu masini  ce id am?
Ero(area / rile) / warning-(ul / urile): sunt multe din cauza acelei lini unde tre sa pun masinile
Liniile de cod / sursa / script-ul:

if(strcmp(cmd, "/respawnfactioncars", true) == 0 || strcmp(cmd, "/rfc", true) == 0)
    {
      if(PlayerInfo[playerid][pLeader] == 1)//Leader la PD
      {
         SetVehicleToRespawn(ID masina de la newcar de la PD);
         ........//Aici pui cate SetVehicleToRespawn ai la ID-urile de la masinile de la PD
         for(new i = 0; i < MAX_PLAYERS; i ++)
         {
           if(PlayerInfo[i][pMember] == 1||PlayerInfo[i][pLeader] == 1)
           {
                format(string, sizeof(string), "Factiune: Toate masinile factiunii au fost respawnate de catre %s.", sendername);
                SCM(i,COLOR_GREY,string);
           }
         }
      }
      else if(PlayerInfo[playerid][pLeader] == 2)//Leader la factiunea cu numarul 2
      {
         SetVehicleToRespawn(Aici pui IDurile de la newcar/daca le ai definite cu new masina pd1= addstatic vehicle);
         ....//Aici pui cate SetVehicleToRespawn ai nevoie
         for(new i = 0; i < MAX_PLAYERS; i ++)
         {
           if(PlayerInfo[i][pMember] == 2||PlayerInfo[i][pLeader] == 2)
           {
                format(string, sizeof(string), "Factiune: Toate masinile factiunii au fost respawnate de catre %s.", sendername);
                SCM(i,COLOR_GREY,string);
           }
         }
      }
      else if(PlayerInfo[playerid][pLeader] == 3)//Leader la factiunea cu numarul 3
      {
         SetVehicleToRespawn(ID-ul sau numele vehiculului);
         ....//Aici pui cate SetVechicleToRespawn ai nevoie
         for(new i = 0; i < MAX_PLAYERS; i ++)
         {
           if(PlayerInfo[i][pMember] == 3||PlayerInfo[i][pLeader] == 3)
           {
                format(string, sizeof(string), " Factiune: Toate masinile factiunii au fost respawnate de catre %s.", sendername);
                SCM(i,COLOR_GREY,string);
           }
         }

      }
      else if(PlayerInfo[playerid][pLeader] == 4)//Leader la factiunea cu numarul 4
      {
         SetVehicleToRespawn(Aici pui ID-ul sau numele vehiculului);
         ....//Aici pui cate SetVehicleToRespawn ai nevoie
         for(new i = 0; i < MAX_PLAYERS; i ++)
         {
           if(PlayerInfo[i][pMember] == 4||PlayerInfo[i][pLeader] == 4)
           {
                format(string, sizeof(string), " Toate masinile factiunii au fost respawnate de catre %s.", sendername);
                SCM(i,COLOR_GREY,string);
           }
         }
.........//Si tot asa in functie de cate factiuni ai.
      }
      else
      {
        SCM(playerid,COLOR_GREY," Nu esti leader la nici una din factiunile noastre !");
      }
      return 1;
    }

 

copcar[0] = AddStaticVehicleEx(599,616.1244,-601.7048,17.4214,271.5325, -1, -1, 30000); // Cop cruiser (Dillimore) 16
    copcar[1] = AddStaticVehicleEx(596,1574.4703,-1710.9795,5.6115,0.4220, -1, -1, 30000); // Cop cruiser 19
    copcar[2] = AddStaticVehicleEx(596,1587.4816,-1710.3594,5.6104,358.9421,-1, -1, 30000); // Cop cruiser 20
    copcar[3] = AddStaticVehicleEx(596,1595.6578,-1710.9442,5.6119,359.6335,0,1,30000); // Cop cruiser 21
    copcar[4] = AddStaticVehicleEx(596,1545.7845,-1684.4004,5.6342,271.1593,0,1,30000); // Cop cruiser 22
    copcar[5] = AddStaticVehicleEx(596,1558.7819,-1710.9503,5.6119,1.1862,0,1,30000); // Cop cruiser 23
    copcar[6] = AddStaticVehicleEx(596,1601.8564,-1704.1805,5.6110,88.9959,-1,-1,30000); // Cop cruiser 24
    copcar[7] = AddStaticVehicleEx(596,1600.9231,-1691.9321,5.6113,91.6221,-1,-1,30000); // Cop cruiser 25
    copcar[8] = AddStaticVehicleEx(596,1600.4153,-1687.9385,5.6118,90.7431,-1,-1,30000); // Cop cruiser 26
    copcar[9] = AddStaticVehicleEx(596,1529.6339,-1683.7720,5.6124,270.5692, -1, -1, 30000); // Cop cruiser 27
    swatcar[0] = AddStaticVehicleEx(427,1544.2870,-1659.3522,5.6119,88.5025,0,125,30000);// Police SWAT enforcer 36

 

Banuiesc ca daca sunt in ea nu se respawneaas, nu?

 

Imagini / Video (optional):
Aţi încercat să rezolvaţi singur?: am incercat sa pun si numele masini "[masina]" si coordonatele ei si nu merge

Edited by Selby

16 answers to this question

Recommended Posts

Posted

La ongamemodeinit dupa ultima functie de creeare a vehiculelor(CreateVehcile, AddStaticVehicle, AddStaticVehicleEx).

 

1859311972_BANNER-GIREADAcopy-min.thumb.png.48e5e420ae2185dce5b244965a1d2601.png

 

Posted (edited)

da, stiu unde trebuie sa pun copcar[0] = AddStaticVehicleEx(599,616.1244,-601.7048,17.4214,271.5325, -1, -1, 30000); // Cop cruiser (Dillimore) 16
  dar ce trebuie pus aici cu rosu?

 

if(strcmp(cmd, "/respawnfactioncars", true) == 0 || strcmp(cmd, "/rfc", true) == 0)
{
if(PlayerInfo[playerid][pLeader] == 1)//Leader la PD
{
 SetVehicleToRespawn(ID masina de la newcar de la PD);
 ........//Aici pui cate SetVehicleToRespawn ai la ID-urile de la masinile de la PD

 for(new i = 0; i < MAX_PLAYERS; i ++)
 {
 if(PlayerInfo[i][pMember] == 1||PlayerInfo[i][pLeader] == 1)
 {
format(string, sizeof(string), "Factiune: Toate masinile factiunii au fost respawnate de catre %s.", sendername);
SCM(i,COLOR_GREY,string);
 }
 }
}

Edited by Selby
Posted (edited)

Ute un exemplu de comanda.

if(strcmp(cmd, "/respawnfactioncars", true) == 0 || strcmp(cmd, "/rfc", true) == 0)
{
if(PlayerInfo[playerid][pLeader] == 1)//Leader la PD
{
SetVehicleToRespawn(1);// 1 2 3 4 5 6 fiind id-urile masinilor luate din GM.
SetVehicleToRespawn(2);
SetVehicleToRespawn(3);
SetVehicleToRespawn(4);
SetVehicleToRespawn(5);
SetVehicleToRespawn(6);
for(new i = 0; i < MAX_PLAYERS; i ++)
{
if(PlayerInfo[pMember] == 1||PlayerInfo[pLeader] == 1)
{
format(string, sizeof(string), "Factiune: Toate masinile factiunii au fost respawnate de catre %s.", sendername);
SCM(i,COLOR_GREY,string);
}
}
}
Edited by Adrian_Petre

 

 

Posted

Nu il asculta a zis o mare prostie lagat de problema ta. Uite asa trebuie sa faci.

 

if(strcmp(cmd, "/respawnfactioncars", true) == 0 || strcmp(cmd, "/rfc", true) == 0)
{
if(PlayerInfo[playerid][pLeader] == 1)//Leader la PD
{
SetVehicleToRespawn(copcar[0]);
SetVehicleToRespawn(copcar[1]);
SetVehicleToRespawn(copcar[2]);
SetVehicleToRespawn(copcar[3]);
SetVehicleToRespawn(copcar[4]);
SetVehicleToRespawn(copcar[5]);
SetVehicleToRespawn(copcar[6]);
SetVehicleToRespawn(copcar[7]);
SetVehicleToRespawn(copcar[8]);
SetVehicleToRespawn(copcar[9]);
for(new i = 0; i < MAX_PLAYERS; i ++)
{
if(PlayerInfo[pMember] == 1||PlayerInfo[pLeader] == 1)
{
format(string, sizeof(string), "Factiune: Toate masinile factiunii au fost respawnate de catre %s.", sendername);
SCM(i,COLOR_GREY,string);
}
}
}
}
 
ID-ul vehiculului respectiv s-a stocat in variabila copcar[0] sau copcar[1] si asa mai departe

 

1859311972_BANNER-GIREADAcopy-min.thumb.png.48e5e420ae2185dce5b244965a1d2601.png

 

Posted

[pawn]stock IsVehicleOccupied(vehicleid) // Returns 1 if there is anyone in the vehicle
{
foreach(Player,i)
{
if(IsPlayerInAnyVehicle(i))
{
if(GetPlayerVehicleID(i)==vehicleid)
{
return 1;
}
else
{
return 0;
}
}
}
}[/pawn]

 

[pawn]if(!(IsVehicleOcupied(copcar[0])))
SetVehicleToRespawn(copcar[0]);
if(!(IsVehicleOcupied(copcar[1])))
SetVehicleToRespawn(copcar[1]);
if(!(IsVehicleOcupied(copcar[2])))
SetVehicleToRespawn(copcar[2]);
if(!(IsVehicleOcupied(copcar[3])))
SetVehicleToRespawn(copcar[3]);
if(!(IsVehicleOcupied(copcar[4])))
SetVehicleToRespawn(copcar[4]);
if(!(IsVehicleOcupied(copcar[5])))
SetVehicleToRespawn(copcar[5]);
if(!(IsVehicleOcupied(copcar[6])))
SetVehicleToRespawn(copcar[6]);
if(!(IsVehicleOcupied(copcar[7])))
SetVehicleToRespawn(copcar[7]);
if(!(IsVehicleOcupied(copcar[8])))
SetVehicleToRespawn(copcar[8]);
if(!(IsVehicleOcupied(copcar[9])))
SetVehicleToRespawn(copcar[9]);[/pawn]

 

 

1859311972_BANNER-GIREADAcopy-min.thumb.png.48e5e420ae2185dce5b244965a1d2601.png

 

Posted (edited)

#include <foreach>

 

stock IsVehicleOccupied(vehicleid) // Returns 1 if there is anyone in the vehicle
{
    foreach(Player,i)
    {
    if(IsPlayerInAnyVehicle(i))
    {
    if(GetPlayerVehicleID(i)==vehicleid)
    {
    SetVehicleToRespawn(copcar[0]);
    if(!(IsVehicleOcupied(copcar[1])))
    SetVehicleToRespawn(copcar[1]);
    if(!(IsVehicleOcupied(copcar[2])))
    SetVehicleToRespawn(copcar[2]);
    if(!(IsVehicleOcupied(copcar[3])))
    SetVehicleToRespawn(copcar[3]);
    if(!(IsVehicleOcupied(copcar[4])))
    SetVehicleToRespawn(copcar[4]);
    if(!(IsVehicleOcupied(copcar[5])))
    SetVehicleToRespawn(copcar[5]);
    if(!(IsVehicleOcupied(copcar[6])))
    SetVehicleToRespawn(copcar[6]);
    if(!(IsVehicleOcupied(copcar[7])))
    SetVehicleToRespawn(copcar[7]);
    if(!(IsVehicleOcupied(copcar[8])))
    SetVehicleToRespawn(copcar[8]);
    if(!(IsVehicleOcupied(copcar[9])))
    SetVehicleToRespawn(copcar[9]);
        return 1;
    }
    else
    {
    return 1;
    }
    }
    }
}

 

 

stau in masina dau fcr si se respawneaza

Edited by Selby
Posted

Frate tu ai fost atent ce am postat eu. Sunt doua functii diferite una e la comanda si una este o functie.

 

1859311972_BANNER-GIREADAcopy-min.thumb.png.48e5e420ae2185dce5b244965a1d2601.png

 

Posted

Pune

	stock IsVehicleOccupied(vehicleid) // Returns 1 if there is anyone in the vehicle
	{
	foreach(Player,i)
	{
	if(IsPlayerInAnyVehicle(i))
	{
	if(GetPlayerVehicleID(i)==vehicleid)
	{
	return 1;
	}
	else
	{
	return 0;
	}
	}
	}
	}
La sfarsitul modului,si celalalt cod,la OnPlayerEnterVehicle.

 

 

Posted
  1. if(!(IsVehicleOcupied(copcar[0])))
  2. SetVehicleToRespawn(copcar[0]);
  3. if(!(IsVehicleOcupied(copcar[1])))
  4. SetVehicleToRespawn(copcar[1]);
  5. if(!(IsVehicleOcupied(copcar[2])))
  6. SetVehicleToRespawn(copcar[2]);
  7. if(!(IsVehicleOcupied(copcar[3])))
  8. SetVehicleToRespawn(copcar[3]);
  9. if(!(IsVehicleOcupied(copcar[4])))
  10. SetVehicleToRespawn(copcar[4]);
  11. if(!(IsVehicleOcupied(copcar[5])))
  12. SetVehicleToRespawn(copcar[5]);
  13. if(!(IsVehicleOcupied(copcar[6])))
  14. SetVehicleToRespawn(copcar[6]);
  15. if(!(IsVehicleOcupied(copcar[7])))
  16. SetVehicleToRespawn(copcar[7]);
  17. if(!(IsVehicleOcupied(copcar[8])))
  18. SetVehicleToRespawn(copcar[8]);
  19. if(!(IsVehicleOcupied(copcar[9])))
  20. SetVehicleToRespawn(copcar[9]);

il pui la comanda ta de respawn

 

1859311972_BANNER-GIREADAcopy-min.thumb.png.48e5e420ae2185dce5b244965a1d2601.png

 

Posted

Dar nu inteleg de ce nu sunteti mai expliciti, adica din cate am inteles asta trebuie sa fac:

 

if(strcmp(cmd, "/factioncarsrespawn", true) == 0 || strcmp(cmd, "/fcr", true) == 0)
    {
        if(PlayerInfo[playerid][pLeader] == 1)//Leader la PD
        {
                 if(!(IsVehicleOcupied(copcar[0])))
                SetVehicleToRespawn(copcar[0]);
                if(!(IsVehicleOcupied(copcar[1])))
                SetVehicleToRespawn(copcar[1]);
                if(!(IsVehicleOcupied(copcar[2])))
                SetVehicleToRespawn(copcar[2]);
                if(!(IsVehicleOcupied(copcar[3])))
                SetVehicleToRespawn(copcar[3]);
                if(!(IsVehicleOcupied(copcar[4])))
                SetVehicleToRespawn(copcar[4]);
                if(!(IsVehicleOcupied(copcar[5])))
                SetVehicleToRespawn(copcar[5]);
                if(!(IsVehicleOcupied(copcar[6])))
                SetVehicleToRespawn(copcar[6]);
                if(!(IsVehicleOcupied(copcar[7])))
                SetVehicleToRespawn(copcar[7]);
                if(!(IsVehicleOcupied(copcar[8])))
                SetVehicleToRespawn(copcar[8]);
                if(!(IsVehicleOcupied(copcar[9])))
                SetVehicleToRespawn(copcar[9]);

            for(new i = 0; i < MAX_PLAYERS; i ++)
            {
                if(PlayerInfo[pMember] == 1||PlayerInfo[pLeader] == 1)
                {
                    format(string, sizeof(string), "Factiune: Toate masinile factiunii au fost respawnate de catre %s.", sendername);
                    SendClientMessage(i,COLOR_GREY,string);
                }
               }
        }
    }
    stock IsVehicleOccupied(vehicleid) // Returns 1 if there is anyone in the vehicle
    {
    foreach(Player,i)
    {
    if(IsPlayerInAnyVehicle(i))
    {
    if(GetPlayerVehicleID(i)==vehicleid)
    {
    return 1;
    }
    else
    {
    return 0;
    }
    }
    }
    }

si da 100000 eroari

Posted

Asta fiindca ai pus dupa cum vad stock-ul dupa comanda,ti-am spus sa o pui la SFARSITUL GAMEMODE-ULUI LA SFARSIT DE TOT!

 

 

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.