Jump to content

Intrebare


LorD.

Recommended Posts

Salut, am o intrebare . Am comanda /lock care incuie si descuie usa la masina, cum pot face comanda sa aiba un HotKey pe tasta N , de exemplu apesi N si foloseste comanda /lock, nu cred ca va trebuie prea multe detalii , stiti la ce ma refer.

Spoiler

 if(strcmp(cmd, "/lock", true) == 0)
{
   if(IsPlayerConnected(playerid))
   {
      new ivID = GetClosestVehicleToPlayer(playerid);
      new namee[MAX_PLAYER_NAME];
      GetPlayerName(playerid, namee, sizeof(namee));
      if(PlayerInfo[playerid][pPcarkey] == ivID || PlayerInfo[playerid][pPcarkey2] == ivID || PlayerInfo[playerid][pPcarkey3] == ivID)
      {
     //    if(strcmp(namee,CarInfo[idcar][cOwner], true) == 0)
       //  {
         if(GetClosestVehicleToPlayer(playerid) > 5.0)
          {
            if(CarInfo[ivID][cLock] == 0)
            {
               //CarInfo[idcar][cLock] = 1;
               CarInfo[ivID][cLock] = 1;
               format(string, sizeof(string), "%s~n~~r~Locked",CarInfo[ivID][cDescription]);
               GameTextForPlayer(playerid, string, 3000, 3);
               GetVehicleParamsEx(ivID,engine,lights,alarm,doors,bonnet,boot,objective);
               SetVehicleParamsEx(ivID,engine,lights,alarm,1,bonnet,boot,objective);
               //OnCarUpdate();
               return 1;
            }
            if(CarInfo[ivID][cLock] == 1)
            {
               //CarInfo[idcar][cLock] = 0;
               CarInfo[ivID][cLock] = 0;
               format(string, sizeof(string), "%s~n~~g~Unlocked",CarInfo[ivID][cDescription]);
               GameTextForPlayer(playerid, string, 3000, 3);
               GetVehicleParamsEx(ivID,engine,lights,alarm,doors,bonnet,boot,objective);
               SetVehicleParamsEx(ivID,engine,lights,alarm,0,bonnet,boot,objective);
               //OnCarUpdate();
               return 1;
            }
         }
         }
      return 1;
   }
}

 

Link to comment
Share on other sites

Quote

if(newkeys == KEY_NO)
    {

       new ivID = GetClosestVehicleToPlayer(playerid);
      new namee[MAX_PLAYER_NAME];
      GetPlayerName(playerid, namee, sizeof(namee));
      if(PlayerInfo[playerid][pPcarkey] == ivID || PlayerInfo[playerid][pPcarkey2] == ivID || PlayerInfo[playerid][pPcarkey3] == ivID)
      {
     //    if(strcmp(namee,CarInfo[idcar][cOwner], true) == 0)
       //  {
         if(GetClosestVehicleToPlayer(playerid) > 5.0)
          {
            if(CarInfo[ivID][cLock] == 0)
            {
               //CarInfo[idcar][cLock] = 1;
               CarInfo[ivID][cLock] = 1;
               format(string, sizeof(string), "%s~n~~r~Locked",CarInfo[ivID][cDescription]);
               GameTextForPlayer(playerid, string, 3000, 3);
               GetVehicleParamsEx(ivID,engine,lights,alarm,doors,bonnet,boot,objective);
               SetVehicleParamsEx(ivID,engine,lights,alarm,1,bonnet,boot,objective);
               //OnCarUpdate();
               return 1;
            }
            if(CarInfo[ivID][cLock] == 1)
            {
               //CarInfo[idcar][cLock] = 0;
               CarInfo[ivID][cLock] = 0;
               format(string, sizeof(string), "%s~n~~g~Unlocked",CarInfo[ivID][cDescription]);
               GameTextForPlayer(playerid, string, 3000, 3);
               GetVehicleParamsEx(ivID,engine,lights,alarm,doors,bonnet,boot,objective);
               SetVehicleParamsEx(ivID,engine,lights,alarm,0,bonnet,boot,objective);
               //OnCarUpdate();
               return 1;
            }
         }
         }
      return 1;
   }
}

Incearca asa, daca ai deja KEY_NO adaugi jos, fara sa mai scri tu aia cu KEY_NO

In caz ca nu sti trebuie la public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)

giphy.gif

Link to comment
Share on other sites

Nu prea am inteles nimic din ce mi-ai explicat...
Adaug la OnPlayerKeyStateChange

Acum 42 minute, Extremys a spus:
  Quote

if(newkeys == KEY_NO)
    {

       new ivID = GetClosestVehicleToPlayer(playerid);
      new namee[MAX_PLAYER_NAME];
      GetPlayerName(playerid, namee, sizeof(namee));
      if(PlayerInfo[playerid][pPcarkey] == ivID || PlayerInfo[playerid][pPcarkey2] == ivID || PlayerInfo[playerid][pPcarkey3] == ivID)
      {
     //    if(strcmp(namee,CarInfo[idcar][cOwner], true) == 0)
       //  {
         if(GetClosestVehicleToPlayer(playerid) > 5.0)
          {
            if(CarInfo[ivID][cLock] == 0)
            {
               //CarInfo[idcar][cLock] = 1;
               CarInfo[ivID][cLock] = 1;
               format(string, sizeof(string), "%s~n~~r~Locked",CarInfo[ivID][cDescription]);
               GameTextForPlayer(playerid, string, 3000, 3);
               GetVehicleParamsEx(ivID,engine,lights,alarm,doors,bonnet,boot,objective);
               SetVehicleParamsEx(ivID,engine,lights,alarm,1,bonnet,boot,objective);
               //OnCarUpdate();
               return 1;
            }
            if(CarInfo[ivID][cLock] == 1)
            {
               //CarInfo[idcar][cLock] = 0;
               CarInfo[ivID][cLock] = 0;
               format(string, sizeof(string), "%s~n~~g~Unlocked",CarInfo[ivID][cDescription]);
               GameTextForPlayer(playerid, string, 3000, 3);
               GetVehicleParamsEx(ivID,engine,lights,alarm,doors,bonnet,boot,objective);
               SetVehicleParamsEx(ivID,engine,lights,alarm,0,bonnet,boot,objective);
               //OnCarUpdate();
               return 1;
            }
         }
         }
      return 1;
   }

Si atat? Nu mai am nimic cu KEY_NO , am cautat cu CTRL+F.

Spune-mi mai explicit, unde si ce pun.

Link to comment
Share on other sites

Deci am pus ce mi-ai dat la onplayerstatechenge si am dat sa-l compilez si dupa ce s-a terminat de compilat imi zice asa:

Pawn compiler 3.2.3664              Copyright (c) 1997-2006, ITB CompuPhase

Si fisierul .amx care s-a facut are 0 bytes

Link to comment
Share on other sites

Daca sterg ce mi-ai dat si compilez scrie asa

Spoiler

 

Pawn compiler 3.2.3664              Copyright (c) 1997-2006, ITB CompuPhase

Header size:          13492 bytes
Code size:          2721176 bytes
Data size:          3669376 bytes
Stack/heap size:      16384 bytes; estimated max. usage: unknown, due to recursion
Total requirements: 6420428 bytes


 

 

Edited by LorD.
Link to comment
Share on other sites

OnPlayerKeyStateChange pui asta:

if(newkeys & KEY_NO)
{
	if(IsPlayerConnected(playerid))
	{
		new ivID = GetClosestVehicleToPlayer(playerid);
		new namee[MAX_PLAYER_NAME];
		GetPlayerName(playerid, namee, sizeof(namee));
		if(PlayerInfo[playerid][pPcarkey] == ivID || PlayerInfo[playerid][pPcarkey2] == ivID || PlayerInfo[playerid][pPcarkey3] == ivID)
		{
			if(GetClosestVehicleToPlayer(playerid) > 5.0)
			{
				if(CarInfo[ivID][cLock] == 0)
				{
				   CarInfo[ivID][cLock] = 1;
				   format(string, sizeof(string), "%s~n~~r~Locked",CarInfo[ivID][cDescription]);
				   GameTextForPlayer(playerid, string, 3000, 3);
				   GetVehicleParamsEx(ivID,engine,lights,alarm,doors,bonnet,boot,objective);
				   SetVehicleParamsEx(ivID,engine,lights,alarm,1,bonnet,boot,objective);
				}
				if(CarInfo[ivID][cLock] == 1)
				{
				   CarInfo[ivID][cLock] = 0;
				   format(string, sizeof(string), "%s~n~~g~Unlocked",CarInfo[ivID][cDescription]);
				   GameTextForPlayer(playerid, string, 3000, 3);
				   GetVehicleParamsEx(ivID,engine,lights,alarm,doors,bonnet,boot,objective);
				   SetVehicleParamsEx(ivID,engine,lights,alarm,0,bonnet,boot,objective);
				}
			}
		}
	}
}

 

Link to comment
Share on other sites

Acum 14 minute, xpLode a spus:

OnPlayerKeyStateChange pui asta:


if(newkeys & KEY_NO)
{
	if(IsPlayerConnected(playerid))
	{
		new ivID = GetClosestVehicleToPlayer(playerid);
		new namee[MAX_PLAYER_NAME];
		GetPlayerName(playerid, namee, sizeof(namee));
		if(PlayerInfo[playerid][pPcarkey] == ivID || PlayerInfo[playerid][pPcarkey2] == ivID || PlayerInfo[playerid][pPcarkey3] == ivID)
		{
			if(GetClosestVehicleToPlayer(playerid) > 5.0)
			{
				if(CarInfo[ivID][cLock] == )
				{
				   CarInfo[ivID][cLock] = 1;
				   format(string, sizeof(string), "%s~n~~r~Locked",CarInfo[ivID][cDescription]);
				   GameTextForPlayer(playerid, string, 3000, 3);
				   GetVehicleParamsEx(ivID,engine,lights,alarm,doors,bonnet,boot,objective);
				   SetVehicleParamsEx(ivID,engine,lights,alarm,1,bonnet,boot,objective);
				}
				if(CarInfo[ivID][cLock] == 1)
				{
				   CarInfo[ivID][cLock] = ;
				   format(string, sizeof(string), "%s~n~~g~Unlocked",CarInfo[ivID][cDescription]);
				   GameTextForPlayer(playerid, string, 3000, 3);
				   GetVehicleParamsEx(ivID,engine,lights,alarm,doors,bonnet,boot,objective);
				   SetVehicleParamsEx(ivID,engine,lights,alarm,,bonnet,boot,objective);
				}
			}
		}
	}
}

 

Cand apasa  N  doar mi-o descuie, nu o  incuie,nu conteaza mi-a rezolvat problam @Extremys

Acum 10 minute, Extremys a spus:

Compileaza.l pe acesta.

gamemode.pwn

Mersi mult, merge perfect :D

 

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.

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