Jump to content
  • 0

Problema cu o comanda!


Roach

Question

CMD:car(playerid,params[])
{
	if(AccInfo[playerid][Level] >= 3)
	{
		new Index;
	    new tmp[256];  tmp  = strtok(params,Index);
		new tmp2[256]; tmp2 = strtok(params,Index);
		new tmp3[256]; tmp3 = strtok(params,Index);
	    if(!strlen(tmp)) return
		SendClientMessage(playerid, LIGHTBLUE2, "Usage: /car [ModelID/Name] [Colour1] [Colour2]") &&
   	    SendClientMessage(playerid, orange, "Function: Will create a Car with specified Colours");
		new car;
		new string[128];
		new colour1, colour2;
   		if(!IsNumeric(tmp))
	 	car = GetVehicleModelIDFromName(tmp);
  		else car = strval(tmp);
		if(car < 400 || car > 611) return  SendClientMessage(playerid, red, "ERROR: Invalid Vehicle Model ID!");
		if(!strlen(tmp2)) colour1 = random(126); else colour1 = strval(tmp2);
		if(!strlen(tmp3)) colour2 = random(126); else colour2 = strval(tmp3);

		if(AccInfo[playerid][pCar] != -1 && !IsPlayerAdmin(playerid))
		EraseVeh(AccInfo[playerid][pCar]);
		new LVehicleID;
		new Float:X,Float:Y,Float:Z;
		new Float:Angle,int1;
		GetPlayerPos(playerid, X,Y,Z);
		GetPlayerFacingAngle(playerid,Angle);
		int1 = GetPlayerInterior(playerid);
		LVehicleID = CreateVehicle(car, X+3,Y,Z, Angle, colour1, colour2, -1);
		LinkVehicleToInterior(LVehicleID,int1);
		AccInfo[playerid][pCar] = LVehicleID;
		SendCommandToAdmins(playerid,"Car");
		format(string, sizeof(string), "%s Spawned a \"%s\" (Model:%d) Colours (%d, %d), Pos: X:%0.2f, Y:%0.2f, Z:%0.2f", pName(playerid), VehicleNames[car-400], car, colour1, colour2, X, Y, Z);
        SaveIn("CarSpawns",string);
		format(string, sizeof(string), "|- You have Spawned a \"%s\" (Model: %d) with Colours: %d,%d -|", VehicleNames[car-400], car, colour1, colour2);
		return SendClientMessage(playerid,LIGHTBLUE, string);
	}
	else return ErrorMessages(playerid, 6);
}

Am o problema cu comanda asta, de fiecare data cand in joc(CHAT) dau numai "/car" imi da "ERROR: Invalid Vehicle Model ID!"inloc sami dea "Usage: /car [ModelID/Name] [Colour1] [Colour2]" dar nu inteleg de ce, ma poate ajuta cineva?

142sj0l.png

Underground-GFX

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

!strlen = isnull la zcmd

adica asa o sa fie comanda:

CMD:car(playerid,params[])
{
   if(AccInfo[playerid][Level] >= 3)
   {
      new Index;
       new tmp[256];  tmp  = strtok(params,Index);
      new tmp2[256]; tmp2 = strtok(params,Index);
      new tmp3[256]; tmp3 = strtok(params,Index);
       if(isnull(tmp)) return
      SendClientMessage(playerid, LIGHTBLUE2, "Usage: /car [ModelID/Name] [Colour1] [Colour2]") &&
          SendClientMessage(playerid, orange, "Function: Will create a Car with specified Colours");
      new car;
      new string[128];
      new colour1, colour2;
         if(!IsNumeric(tmp))
       car = GetVehicleModelIDFromName(tmp);
        else car = strval(tmp);
      if(car < 400 || car > 611) return  SendClientMessage(playerid, red, "ERROR: Invalid Vehicle Model ID!");
      if(!strlen(tmp2)) colour1 = random(126); else colour1 = strval(tmp2);
      if(!strlen(tmp3)) colour2 = random(126); else colour2 = strval(tmp3);

      if(AccInfo[playerid][pCar] != -1 && !IsPlayerAdmin(playerid))
      EraseVeh(AccInfo[playerid][pCar]);
      new LVehicleID;
      new Float:X,Float:Y,Float:Z;
      new Float:Angle,int1;
      GetPlayerPos(playerid, X,Y,Z);
      GetPlayerFacingAngle(playerid,Angle);
      int1 = GetPlayerInterior(playerid);
      LVehicleID = CreateVehicle(car, X+3,Y,Z, Angle, colour1, colour2, -1);
      LinkVehicleToInterior(LVehicleID,int1);
      AccInfo[playerid][pCar] = LVehicleID;
      SendCommandToAdmins(playerid,"Car");
      format(string, sizeof(string), "%s Spawned a \"%s\" (Model:%d) Colours (%d, %d), Pos: X:%0.2f, Y:%0.2f, Z:%0.2f", pName(playerid), VehicleNames[car-400], car, colour1, colour2, X, Y, Z);
        SaveIn("CarSpawns",string);
      format(string, sizeof(string), "|- You have Spawned a \"%s\" (Model: %d) with Colours: %d,%d -|", VehicleNames[car-400], car, colour1, colour2);
      return SendClientMessage(playerid,LIGHTBLUE, string);
   }
   else return ErrorMessages(playerid, 6);
}

Link to comment
Share on other sites

!strlen = isnull la zcmd

adica asa o sa fie comanda:

CMD:car(playerid,params[])
{
   if(AccInfo[playerid][Level] >= 3)
   {
      new Index;
       new tmp[256];  tmp  = strtok(params,Index);
      new tmp2[256]; tmp2 = strtok(params,Index);
      new tmp3[256]; tmp3 = strtok(params,Index);
       if(isnull(tmp)) return
      SendClientMessage(playerid, LIGHTBLUE2, "Usage: /car [ModelID/Name] [Colour1] [Colour2]") &&
          SendClientMessage(playerid, orange, "Function: Will create a Car with specified Colours");
      new car;
      new string[128];
      new colour1, colour2;
         if(!IsNumeric(tmp))
       car = GetVehicleModelIDFromName(tmp);
        else car = strval(tmp);
      if(car < 400 || car > 611) return  SendClientMessage(playerid, red, "ERROR: Invalid Vehicle Model ID!");
      if(!strlen(tmp2)) colour1 = random(126); else colour1 = strval(tmp2);
      if(!strlen(tmp3)) colour2 = random(126); else colour2 = strval(tmp3);

      if(AccInfo[playerid][pCar] != -1 && !IsPlayerAdmin(playerid))
      EraseVeh(AccInfo[playerid][pCar]);
      new LVehicleID;
      new Float:X,Float:Y,Float:Z;
      new Float:Angle,int1;
      GetPlayerPos(playerid, X,Y,Z);
      GetPlayerFacingAngle(playerid,Angle);
      int1 = GetPlayerInterior(playerid);
      LVehicleID = CreateVehicle(car, X+3,Y,Z, Angle, colour1, colour2, -1);
      LinkVehicleToInterior(LVehicleID,int1);
      AccInfo[playerid][pCar] = LVehicleID;
      SendCommandToAdmins(playerid,"Car");
      format(string, sizeof(string), "%s Spawned a \"%s\" (Model:%d) Colours (%d, %d), Pos: X:%0.2f, Y:%0.2f, Z:%0.2f", pName(playerid), VehicleNames[car-400], car, colour1, colour2, X, Y, Z);
        SaveIn("CarSpawns",string);
      format(string, sizeof(string), "|- You have Spawned a \"%s\" (Model: %d) with Colours: %d,%d -|", VehicleNames[car-400], car, colour1, colour2);
      return SendClientMessage(playerid,LIGHTBLUE, string);
   }
   else return ErrorMessages(playerid, 6);
}

Asta i-am zis si eu pe Y!M, si cica: "Acum imi spui ?!?" =))

Sa-mi zici daca ai rezolvat.

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.