Jump to content
  • 0

vreau sa fac din comanda buton


mihai441

Question

am facut o poarta si vreau sa se deschida daca playerul apasa click , daca este  langa poarta  , daca se numeste ....  am facut ceva da nu merge


#include <a_samp>

#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_BLUE 0x2641FEAA
#define FILTERSCRIPT
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
forward GateClose();
new casa;
enum pInfo
{
pFishSkill,
};
new PlayerInfo[MAX_PLAYERS][pInfo];
public OnFilterScriptInit()
{
	casa = CreateObject(980, 1497.9704589844, -700.01293945313, 96.523391723633, 0, 0, 0);
    CreateObject(1239, 70.946022033691, -1523.2164306641, 4.0335631370544, 0, 0, 0);
    CreateObject(1872, 2484.0852050781, -1664.6156005859, 12.34375, 0, 0, 0);
    CreateObject(7505, 2470.2509765625, -1650.9846191406, 14.024735450745, 0, 0, 0);
    CreateObject(3749, 1497.7768554688, -698.67248535156, 99.608413696289, 0, 0, 0);
    CreateObject(3877, 1508.0806884766, -699.92834472656, 95.409622192383, 0, 0, 0);
    CreateObject(3877, 1487.1959228516, -700.11193847656, 95.415740966797, 0, 0, 0);
    CreateObject(3528, 1497.4173583984, -700.74462890625, 105.40616607666, 0, 0, 262);
	CreateObject(9833, 1481.1741943359, -685.87902832031, 107.33651733398, 0, 0, 0);
    CreateObject(9833, 1512.4923095703, -685.88250732422, 107.16002655029, 0, 0, 0);
     

}

public OnFilterScriptExit()
{
	return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
     if(newkeys == KEY_FIRE)
	 {
        if(PlayerToPoint(5,playerid,1497.7893,-700.6332,94.7500))
		 {
             if (PlayerInfo[playerid][pFishSkill] == 785)
			 {
                   MoveObject(casa, 1497.9704589844, -700.01293945313, 90.773391723633, 5.5);
                   SetTimer("GateClose", 2000, 0);
                   SendClientMessage(playerid, COLOR_BLUE,"Ai deschis poarta");
                   return 1;
             }
		  }
	}
	return 0;
}

public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
    if(IsPlayerConnected(playerid))
	{
		new Float:oldposx, Float:oldposy, Float:oldposz;
		new Float:tempposx, Float:tempposy, Float:tempposz;
		GetPlayerPos(playerid, oldposx, oldposy, oldposz);
		tempposx = (oldposx -x);
		tempposy = (oldposy -y);
		tempposz = (oldposz -z);
		//printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
		if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
		{
			return 1;
		}
	}
	return 0;
}

public GateClose()
{
    MoveObject (casa,1497.9704589844, -700.01293945313, 96.523391723633, 2.5);
    return 1;
}

nu apare eroare dar nu se deschide :( ma puteti ajuta?

Link to comment
Share on other sites

9 answers to this question

Recommended Posts

Uita-te mai bine in filterscript, si observa ca pFishSkill, nu il folosesti nicaieri, doar il declari, de aici rezulta ca tot timpul, tabloul multidimensional pFishSkill, pt fiecare player o sa aiba valoarea 0 ... Daca, intr'adevar, vrei sa folosesti pFishSkill, atunci implementeaza acest FS in Gamemode.

Link to comment
Share on other sites

in loc de: if (PlayerInfo[playerid][pFishSkill] == 785) pui asa:

new str[MAX_PLAYER_NAME];
GetPlayerName(playerid,str,sizeof(str));
if(!strcmp(str,"KoBrA",false))
ia, foloseste FS asta ... e putin mai optimizat:
#include <a_samp>

#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_BLUE 0x2641FEAA

new casa;
forward GateClose();

public OnFilterScriptInit()
{
	casa = CreateObject(980, 1497.9704, -700.01293945313, 96.523391723633, 0, 0,   0);
    CreateObject(1239, 70.946022033691, -1523.2164306641, 4.0335631370544, 0, 0,   0);
    CreateObject(1872, 2484.0852050781, -1664.6156005859, 12.343752132345, 0, 0,   0);
    CreateObject(7505, 2470.2509765625, -1650.9846191406, 14.024735450745, 0, 0,   0);
    CreateObject(3749, 1497.7768554688, -698.67248535156, 99.608413696289, 0, 0,   0);
    CreateObject(3877, 1508.0806884766, -699.92834472656, 95.409622192383, 0, 0,   0);
    CreateObject(3877, 1487.1959228516, -700.11193847656, 95.415740966797, 0, 0,   0);
    CreateObject(3528, 1497.4173583984, -700.74462890625, 105.40616607666, 0, 0, 262);
	CreateObject(9833, 1481.1741943359, -685.87902832031, 107.33651733398, 0, 0,   0);
    CreateObject(9833, 1512.4923095703, -685.88250732422, 107.16002655029, 0, 0,   0);
    return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	static str[MAX_PLAYER_NAME];
	GetPlayerName(playerid,str,sizeof(str));
    if(newkeys & KEY_FIRE)
	{
       	if(IsPlayerInRangeOfPoint(playerid, 5.0, 1497.7893, -700.6332, 94.7500))
		{
        	if(!strcmp(str,"KoBrA",false))
			{
            	MoveObject(casa, 1497.9704589844, -700.01293945313, 90.773391723633, 5.5);
                SetTimer("GateClose", 2000, 0);
                SendClientMessage(playerid, COLOR_BLUE,"Ai deschis poarta.");
                return 1;
            }
		}
	}
	return 1;
}

public GateClose()
{
    MoveObject(casa, 1497.9704589844, -700.01293945313, 96.523391723633, 2.5);
    return 1;
}

pastebin: http://pastebin.com/NnQGqafe

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Similar Content

    • By xVincenzo
      salut, vreau si eu o comanda de /updates daca se poate!
    • By Wreeper
      Salut. M-am gandit de recent sa bag niste culori noi la texte, dar nu vad cum pot sa fac asta. SA:MP e SA:MP si din cauza asta majoritatea culoriilor arata ceva genul asta:
      0xFFC266AA
      M-am gandit ca un destept ce sunt sa pun culoare ROSIE (#FF0000) si sa fac:
      #define RED 0xFFFF0000
      Bineinteles ca e munca Wreepareasca si imi da culoare alba. Din ce cauza? Ce convertor exista sa fac asemenea culori?
    • By TheGodfather
      Salut, vreau sa fac o comanda /lastchat cu care sa pot sa vad ultimele x mesaje ale unui jucator. Am incercat asa dar nu imi afiseaza nimic.
      YCMD:lastchat(playerid, params[], help) {
          if(aspam[playerid] > 0) return SCMEx(playerid, COLOR_LIGHTRED, "[Command Anti-Spam] {FFFFFF}Wait %d seconds.", aspam[playerid]);
          if(PlayerInfo[playerid][pAdmin] < 😎 return SCM(playerid,COLOR_WHITE,AdminOnly);
          new giveplayerid[25],id,cont,name[30];
          if(sscanf(params, "s[25]d", giveplayerid, id)) return SCM(playerid,COLOR_GREY, "Syntax: {FFFFFF}/lastchat <name> <number of messages>");
          cont = MySQLCheckAccount(giveplayerid);
          if(cont == 0) return SCM(playerid,COLOR_ERROR,"Error:{FFFFFF} This account was not found in the database!");
          GetPlayerName(playerid, name, sizeof name);
          //
          new szQuery[256], string[180], MemberString[1024], szResult[180], text[180],TitleString[180];
          format(szQuery, sizeof(szQuery), "SELECT * FROM `logs` WHERE `Name`='%s' ORDER BY `ID` DESC LIMIT %d", GetName(playerid), id);
          new Cache: result = mysql_query(SQL, szQuery);
          for(new i, j = cache_num_rows(); i != j; ++i)
          {
              cache_get_field_content(i, "player", szResult); format(name, 256, szResult);
              cache_get_field_content(i, "Text", szResult);  format(text, 256, szResult);
              format(string, sizeof(string), "%s", text);strcat(MemberString, string, sizeof(MemberString));
          }
          cache_delete(result);
          format(TitleString, sizeof(TitleString), "Last %d messages from player %s.", id, name);
          ShowPlayerDialog(playerid, DIALOG_LASTCHAT, DIALOG_STYLE_TABLIST_HEADERS, TitleString, MemberString, "Ok", "Exit");
          //
          return 1;
      }
      case DIALOG_LASTCHAT: {
                  if(!response) return true;
              }
    • By TheGodfather
      Salut, am aceasta comanda /servername dar nu trimite mesajul acela tuturor playerilor, numele la server se schimba corect.
      if(strcmp(cmdtext, "/servername", true) == 0)
          {
              if(PlayerInfo[playerid][pAdmin] < 😎 return SCM(playerid, COLOR_WHITE, AdminOnly);
              new newstring[512], idx, tmp[512];
              tmp = strtok(cmdtext, idx);
              if(strlen(cmdtext[12]) < 1) return SCM(playerid, COLOR_GREY,"Syntax: /servername <nume server>");
              format(tmp, sizeof(tmp), "hostname %s", cmdtext[12]);
              SendRconCommand(tmp);
              format(newstring, sizeof(newstring), "[SERVER] {FFFFFF}Fondator {DA0000}%s {FFFFFF}a schimbat numele server-ului in {FFFFFF}'%s'.", GetName(playerid), cmdtext[12]);
              SCMTA(COLOR_LIGHTBLUE, newstring);
              return 1;
          }
    • By Matei02Mihai
      Cum pot face sa nu mai fie nevoie de acel buton de "Spawn" dupa de trec parola?
  • 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.