#1

Every time i try to make a /car [Car name/Model id] [col1] [col2] it gives me like 30 errors... Could someone make it for me using sscanf and dcmd, or give me link to it? I just cant get it >.< i use PlayerInfo[playerid][pAdminLevel] btw.
Thanks.
Reply
#2

use /v from debug fs just add colors to it(its included in samp package)
Reply
#3

Quote:
Originally Posted by DRIFT_HUNTER
Посмотреть сообщение
use /v from debug fs just add colors to it(its included in samp package)
The colors are the problem >.<
Reply
#4

pawn Код:
//At the top of your script:
new CarSpawned[MAX_PLAYERS];
//OnPlayerCommandText
dcmd(car, 3, cmdtext);
dcmd(dcar, 4, cmdtext); // delete car
//Outside a callback:
dcmd_car(playerid, params[])
{
    new carid, color1, color2, Float:coord[3];
    if(PlayerInfo[playerid][pAdminLevel] >= 2)
    {
        if(sscanf(params, "iii", carid, color1, color2)) return SendClientMessage(playerid, -1, "Usage: /car [carid] [color1] [color2]");
        GetPlayerPos(playerid, coord[0], coord[1], coord[2]);
        CarSpawned[playerid] = CreateVehicle(carid, coord[0], coord[1], coord[2], 0, color1, color2, -1);
    }
    return 1;
}

dcmd_dcar(playerid, params[])
{
    if(PlayerInfo[playerid][pAdminLevel] >= 2)
    {
        DestroyVehicle(CarSpawned[playerid]);
    }
    return 1;
}
Reply
#5

Quote:
Originally Posted by Biesmen
Посмотреть сообщение
pawn Код:
//At the top of your script:
new CarSpawned[MAX_PLAYERS];
//OnPlayerCommandText
dcmd(car, 3, cmdtext);
dcmd(dcar, 4, cmdtext); // delete car
//Outside a callback:
dcmd_car(playerid, params[])
{
    new carid, color1, color2, Float:coord[3];
    if(PlayerInfo[playerid][pAdminLevel] >= 2)
    {
        if(sscanf(params, "iii", carid, color1, color2)) return SendClientMessage(playerid, -1, "Usage: /car [carid] [color1] [color2]");
        GetPlayerPos(playerid, coord[0], coord[1], coord[2]);
        CarSpawned[playerid] = CreateVehicle(carid, coord[0], coord[1], coord[2], 0, color1, color2, -1);
    }
    return 1;
}

dcmd_dcar(playerid, params[])
{
    if(PlayerInfo[playerid][pAdminLevel] >= 2)
    {
        DestroyVehicle(CarSpawned[playerid]);
    }
    return 1;
}
I need /car [Car name/Model id] [col1] [col2]
And it would destroy auto. on the /car cmd
Reply
#6

* bump *
Reply
#7

Quote:
Originally Posted by Markx
Посмотреть сообщение
I need /car [Car name/Model id] [col1] [col2]
And it would destroy auto. on the /car cmd
Oh, sorry boss.
Reply
#8

Quote:
Originally Posted by Biesmen
Посмотреть сообщение
Oh, sorry boss.
...? O_o
Reply
#9

Код:
dcmd_car(playerid,params[])
	{
		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);
		
		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;
		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 SendClientMessage(playerid,red,"Server:Error");
}
I think this could help you!!!
Reply
#10

It would take more time, but you could always just create a dialog system,
where it has categories of every vehicle, Truck, Heavy Trucks, Street Racers, etc.
Then when you select the car, it could come up with anther dialog saying, what color you'd like it, and you enter the Color-code.
The dialog would be placed if you did /createcar(or w.e the command is) alone or you could do /createcar [vID] [Color 1] [Color 2]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)