Jump to content
  • 0

/Car with Plate xD


XpLoD

Question

dcmd_car(playerid,params[]) {
	if(PlayerInfo[playerid][Level] >= 0) {
	    new tmp[256], tmp2[256], tmp3[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index); tmp3 = strtok(params,Index);
	    if(!strlen(tmp)) return SendClientMessage(playerid, red, "USAGE: /car [Modelid/Name] [colour1] [colour2]");
		new car, colour1, colour2, string[128];
   		if(!IsNumeric(tmp)) car = GetVehicleModelIDFromName(tmp); else car = strval(tmp);
		if(car < 400 || car > 611) return  SendClientMessage(playerid, red, "ERROR: Invalid Vehicle Model");
		if(!strlen(tmp2)) colour1 = random(126); else colour1 = strval(tmp2);
		if(!strlen(tmp3)) colour2 = random(126); else colour2 = strval(tmp3);
		if(PlayerInfo[playerid][pCar] != -1 && !IsPlayerAdmin(playerid) ) CarDeleter(PlayerInfo[playerid][pCar]);
		new LVehicleID,Float:X,Float:Y,Float:Z, Float:Angle,int1, LVehicleWorld = GetPlayerVirtualWorld(playerid); GetPlayerPos(playerid, X,Y,Z);	GetPlayerFacingAngle(playerid,Angle);   int1 = GetPlayerInterior(playerid);
       	LVehicleID = AddStaticVehicleEx(car, X+3,Y,Z, Angle, colour1, colour2, 60); PutPlayerInVehicle(playerid, LVehicleID, 0); LinkVehicleToInterior(LVehicleID,int1); SetVehicleVirtualWorld(LVehicleID, LVehicleWorld);
		PutPlayerInVehicle(playerid, LVehicleID, 0);
		PlayerInfo[playerid][pCar] = LVehicleID;
		format(string, sizeof(string), "%s spawned a \"%s\" (Model:%d) colour (%d, %d), at %0.2f, %0.2f, %0.2f", pName(playerid), VehicleNames[car-400], car, colour1, colour2, X, Y, Z);
        SaveToFile("CarSpawns",string);
		format(string, sizeof(string), "You have spawned a \"%s\" (Model:%d) colour (%d, %d)", VehicleNames[car-400], car, colour1, colour2);
		return SendClientMessage(playerid,lightblue, string);
	} else return SendClientMessage(playerid,red,"ERROR: You need to be level 3 to use this command");
}
Salut, stiti cumva cum as putea pune Plate in acesta comanda.. eu intr-un fel am pus'o... si cand dau "/car inf" imi apare masina cu plate-ul dar dupa dispare...
SetVehicleNumberPlate(v, "RsM");

Thx

ll364l6j8dg3et84ks3w.png

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

Incearca asa:

dcmd_car(playerid,params[]) {
	if(PlayerInfo[playerid][Level] >= 0) {
	    new tmp[256], tmp2[256], tmp3[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index); tmp3 = strtok(params,Index);
	    if(!strlen(tmp)) return SendClientMessage(playerid, red, "USAGE: /car [Modelid/Name] [colour1] [colour2]");
		new car, colour1, colour2, string[128];
   		if(!IsNumeric(tmp)) car = GetVehicleModelIDFromName(tmp); else car = strval(tmp);
		if(car < 400 || car > 611) return  SendClientMessage(playerid, red, "ERROR: Invalid Vehicle Model");
		if(!strlen(tmp2)) colour1 = random(126); else colour1 = strval(tmp2);
		if(!strlen(tmp3)) colour2 = random(126); else colour2 = strval(tmp3);
		if(PlayerInfo[playerid][pCar] != -1 && !IsPlayerAdmin(playerid) ) CarDeleter(PlayerInfo[playerid][pCar]);
		new LVehicleID,Float:X,Float:Y,Float:Z, Float:Angle,int1, LVehicleWorld = GetPlayerVirtualWorld(playerid); GetPlayerPos(playerid, X,Y,Z);	GetPlayerFacingAngle(playerid,Angle);   int1 = GetPlayerInterior(playerid);
		LVehicleID = AddStaticVehicleEx(car, X+3,Y,Z, Angle, colour1, colour2, 60); SetVehicleNumberPlate(LVehicleID, "RsM"); PutPlayerInVehicle(playerid, LVehicleID, 0); LinkVehicleToInterior(LVehicleID,int1); SetVehicleVirtualWorld(LVehicleID, LVehicleWorld);
		PutPlayerInVehicle(playerid, LVehicleID, 0);
		PlayerInfo[playerid][pCar] = LVehicleID;
		format(string, sizeof(string), "%s spawned a \"%s\" (Model:%d) colour (%d, %d), at %0.2f, %0.2f, %0.2f", pName(playerid), VehicleNames[car-400], car, colour1, colour2, X, Y, Z);
        SaveToFile("CarSpawns",string);
		format(string, sizeof(string), "You have spawned a \"%s\" (Model:%d) colour (%d, %d)", VehicleNames[car-400], car, colour1, colour2);
		return SendClientMessage(playerid,lightblue, string);
	} else return SendClientMessage(playerid,red,"ERROR: You need to be level 3 to use this command");
}

Link to comment
Share on other sites

merge acum. dar mai am o mica eroare xD adica..

cand dau /car inf. imi apare masina.. nimic gresit.. cu tot cu plate :D deci merge.. eh cand folosesc cmd /np (sa'mi pun eu altu) imi dispare :D dar la masiniile de pe srv puse deja nu dispare

Cmd :

if (strcmp("/np", cmdtext, true, 10) == 0) {
		new Float:x,Float:y,Float:z,Float:ang;
		GetVehiclePos(GetPlayerVehicleID(playerid),x,y,z);
		GetVehicleZAngle(GetPlayerVehicleID(playerid),ang);
	    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,0xFFFFFFFF,"You're not in a vehicle!");
	    ShowPlayerDialog(playerid,50,DIALOG_STYLE_INPUT,"{EE7777}Vehicle Numberplate","{00CC66}Input your new vehicle numberplate below.","Yes","Cancel");
		return 1;
}
//////////////////
if(dialogid == 50) {
		if(response) {
            new Float:x,Float:y,Float:z,Float:ang;
            SetVehicleNumberPlate(GetPlayerVehicleID(playerid), inputtext);
			GetVehiclePos(GetPlayerVehicleID(playerid),x,y,z);
			GetVehicleZAngle(GetPlayerVehicleID(playerid),ang);
			SetVehicleToRespawn(GetPlayerVehicleID(playerid));
			SetVehiclePos(GetPlayerVehicleID(playerid),x,y,z);
			PutPlayerInVehicle(playerid,GetPlayerVehicleID(playerid),0);
			SetVehicleZAngle(GetPlayerVehicleID(playerid),ang);
		} else {
		   	SendClientMessage(playerid,0xFFFFFFFF,"You cancelled!"); } }
////////

ll364l6j8dg3et84ks3w.png

Link to comment
Share on other sites

cand dau /car inf. imi apare masina.. nimic gresit.. cu tot cu plate :D deci merge.. eh cand folosesc cmd /np (sa'mi pun eu altu) imi dispare :D dar la masiniile de pe srv puse deja nu dispare

Cmd :

if (strcmp("/np", cmdtext, true, 10) == 0) {
		new Float:x,Float:y,Float:z,Float:ang;
		GetVehiclePos(GetPlayerVehicleID(playerid),x,y,z);
		GetVehicleZAngle(GetPlayerVehicleID(playerid),ang);
	    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,0xFFFFFFFF,"You're not in a vehicle!");
	    ShowPlayerDialog(playerid,50,DIALOG_STYLE_INPUT,"{EE7777}Vehicle Numberplate","{00CC66}Input your new vehicle numberplate below.","Yes","Cancel");
		return 1;
}
//////////////////
if(dialogid == 50) {
		if(response) {
            new Float:x,Float:y,Float:z,Float:ang;
            SetVehicleNumberPlate(GetPlayerVehicleID(playerid), inputtext);
			GetVehiclePos(GetPlayerVehicleID(playerid),x,y,z);
			GetVehicleZAngle(GetPlayerVehicleID(playerid),ang);
			SetVehicleToRespawn(GetPlayerVehicleID(playerid));
			SetVehiclePos(GetPlayerVehicleID(playerid),x,y,z);
			PutPlayerInVehicle(playerid,GetPlayerVehicleID(playerid),0);
			SetVehicleZAngle(GetPlayerVehicleID(playerid),ang);
		} else {
		   	SendClientMessage(playerid,0xFFFFFFFF,"You cancelled!"); } }
////////

Nu poti rezolva asta.
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • 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.