Jump to content

Ajutor!


mescreid

Recommended Posts

Buna ziua, sunt nou in aceasta ramura "scripting" am luat-o de la 0 si am incercat sa creez un gm:). Am facut eu cate ceva pe acolo, insa nu stiu cum sa fac urmatoarele lucruri

(1) masini, motorul sa porneasca pe 2 sau oricare tasta! 

(2) cum fac ca masinile sa-si aprinda farurile prin comanda sau prin apasarea unei taste!

(3)sa apara acele detalii despre masina sus : http://imgur.com/uqYZJHx

Nu stiu daca ma veti putea ajuta... , dar multumesc anticipat!

Link to comment
Share on other sites

Salut. Te sfatuiesc sa incepi cu ceva mai usor, daca spui ca esti incepator te va depasi si innebuni sa incerci deja sa faci unele sisteme.

1. Ai functia OnPlayerKeyStateChange care verifica pe ce tasta apasa player-ul, de aici te voi lasa sa te informezi.

2. In pawn sunt niste functii numite GetVehicleParamsEx si SetVehicleParamsEx care controleaza motorul, farurile, alarma, usile, etc.

3. Acele 'detalii' se numesc TextDraw-uri si sunt mult mai simplu de facut decat pare, informeaza-te pe wikipedia.

Link to comment
Share on other sites

  • 1 month later...
On 07.05.2016 at 16:01, mescreid said:

Buna ziua, sunt nou in aceasta ramura "scripting" am luat-o de la 0 si am incercat sa creez un gm:). Am facut eu cate ceva pe acolo, insa nu stiu cum sa fac urmatoarele lucruri

(1) masini, motorul sa porneasca pe 2 sau oricare tasta! 

(2) cum fac ca masinile sa-si aprinda farurile prin comanda sau prin apasarea unei taste!

(3)sa apara acele detalii despre masina sus : http://imgur.com/uqYZJHx

Nu stiu daca ma veti putea ajuta... , dar multumesc anticipat!

1. Trebuie sa faci un bind pe tasta 2. Ti-am facut eu acest bind.

if(strcmp(cmd, "/engine",true) == 0) || if(strcmp(PRESSED, "PED_DUCK",true) == 0)
	{
        new vid = GetPlayerVehicleID(playerid);
        if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
        {
            SendClientMessage(playerid, COLOR_GREY, "Server: Doar soferul poate porni masina!");
            return 1;
        }
        if(vid != INVALID_VEHICLE_ID)
		{
 			if(Refueling[playerid] == 1)
			{
			    SendClientMessage(playerid, COLOR_LIGHTBLUE, "{DBED15}Angajat peco:{15D4ED} Domnule asteptati sa umplu rezervorul.");
				return 1;
			}
		    if(Gas[vid] < 1)
		    {
		        GameTextForPlayer(playerid,"~w~~n~~n~~n~~n~~n~~n~~n~~n~Numai ai benzina",1500,3);
		        return 1;
		    }
	   	    new Float:Valoarea;
			GetVehicleHealth(vid,Valoarea);
			if(vid > PreVehicle)
			{
	            if(CarData[vid-PreVehicle][cOwned] == 0 && CarData[vid-PreVehicle][cModel] != 0 && PlayerData[playerid][pAdmin] < 6)
	            {
	                GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
	                SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
	                SendClientMessage(playerid, COLOR_GREY, "Server: Nu ai key pentru aceasta masina (/cumparvehicul)!");
	                return 1;
	            }
	            if(Valoarea < 302 && CarData[vid-PreVehicle][cOwned] == 1)
			    {
			        return 1;
			    }
				if(CarData[vid-PreVehicle][cExploded] == 1 || CarData[vid-PreVehicle][cExploded] == 2)
	            {
	                SendClientMessage(playerid, COLOR_GREY, "Nu poti porni masina inainte de achita reparatiile!");
	                return 1;
	            }
			}
   			if(vid >= 215 && vid <= 222 && HireCar[playerid] != vid)
            {
                GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
                SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
                SendClientMessage(playerid, COLOR_GREY, "Server: Nu ai key pentru aceasta masina (/rentcar)!");
                return 1;
            }
            if(IsABmx(vid))
			{
			    return 1;
			}
            GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
			if(engine == VEHICLE_PARAMS_OFF)
			{
  				SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
  				if(Disguise[playerid] == 0)
             {
  				format(string, sizeof(string), "* %s a pornit motorul la %s.", PlayerData[playerid][pNume],ArIsim[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
				ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				}
			}
   else
			{
			   	SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
			   	if(Disguise[playerid] == 0)
	            {
			   	format(string, sizeof(string), "* %s a oprit motorul la %s.", PlayerData[playerid][pNume],ArIsim[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
				ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				}
			}
        }
        return 1;
    }

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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