Jump to content

sina alex

Membru
  • Posts

    21
  • Joined

  • Last visited

Posts posted by sina alex

  1. 56 minutes ago, Pa4enka said:

    Your mistake is not that you don't know how to do it, but that you made a strategic mistake when planning your gamemode structure: I don't recommend using filterscripts as modules. You should use inludes and you won't have this problem...

    then i must learn to make my extra plus codes as a include and use them on my game mode,hah?

    • Upvote 1
  2. hello i read tutorials but there is a problem for me to place my informations to complate puzzle

     

    i create a bank using mysql in the login fs that use orm to create and  register values for player who login or register(i just know some part of sample code like how create orm how to register values)

    now i want to make another fs for cmds

    there i need informations like admin lvl and .. from db

    idk how i must use orm and how must use syntaxes to first connect to db and then load informations

    i just use my last samples like connecting to db but about loading information i need help and samples

    anyone can help?

  3. On 2/15/2023 at 10:30 PM, Sancky said:

    Most probably is because IDs u are using for dialogs from your mode are same with those in your filterscript, because 'enum' is starting from 0 in both files.

    I would recommend you to use a dialog processor like y_dialog (from YSI) or easyDialog, will improve your code readability because u will not create a thousand of branches in OnDialogResponse and not risking mix-up of IDs because those dialog handlers are working with public functions to execute the code for dialogs.

    thank you for this important tip i will test 

  4. i just change switchs to if but still not work

    public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
    {
    //	new rand = random(sizeof REH);
    	if(response)
    	{
    	 if (dialogid == DIALOG_INLISTNAMES)
    	  {
    	    if (listitem == 0)
    	    {
    	    ShowPlayerDialog(playerid, DIALOG_MANAZEL, DIALOG_STYLE_LIST, "List Interior ha","Emarat\nMamooli\nKoochik", "Entekhab", "Khorooj");
    	    }
          }
    	 if (dialogid == DIALOG_MANAZEL)
    	  {
    	    if (listitem == 0)
    	    {
      	   	 ShowPlayerDialog(playerid, DIALOG_DOLATI, DIALOG_STYLE_LIST, "List Interior ha","Emarat\nMamooli\nKoochik", "Entekhab", "Khorooj");
    		}
    	  }
    	 }
    }

     

  5. 18 hours ago, nobilzeus said:

    do it like this

    enum reh_info {
    	rehInterior,
    	Float:rehX,
    	Float:rehY,
    	Float:rehZ
    }
    new REH[4][reh_info] =
    {
        {3, 234.60, 1187.81, 1080.25},
        {10, 24.37, 1341.18, 1084.37},
        {9,84.92,1324.29,1083.8},
        {6,234.28,1065.22,1084.21}
    };
    case DIALOG_EMARAT: {
    	new rand = random(sizeof REH);
    	switch(listitem) {
    		case 0: GTP(playerid,REH[rand][rehInterior],REH[rand][rehX],REH[rand][rehY],REH[rand][rehZ]); //its line 144
    	}
    }

     

    its look a right structure code but my dialog response wont work now when DIALOG_EMARAT choosed

     

  6. hello i wanna put a random amount in my line

    my codes:

    new Float:REH[] =
    {
        (3, 234.60, 1187.81, 1080.25),
        (10, 24.37, 1341.18, 1084.37),
        (9,84.92,1324.29,1083.8),
        (6,234.28,1065.22,1084.21)
    };

    my funaction:

    forward GTP(playerid,interior,Float:x,Float:y,Float:z);
    public GTP(playerid,interior,Float:x,Float:y,Float:z)
    {
        SetPlayerInterior(playerid,interior);
        SetPlayerPos(playerid,x,y,z);
        return 1;
    }

    forward GTP(playerid,interior,Float:x,Float:y,Float:z);
    public GTP(playerid,interior,Float:x,Float:y,Float:z)
    {
    	SetPlayerInterior(playerid,interior);
    	SetPlayerPos(playerid,x,y,z);
    	return 1;
    }

    my line:

    public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
    {
        new rand = random(sizeof(REH));
        if(response)
        {
         switch(dialogid)
         {
          case DIALOG_EMARAT:
          {
           switch(listitem)
           {
           case 0: GTP(playerid,REH[rand][0],REH[rand][1],REH[rand][2],REH[rand][3]); //its line 144
           }
          }
         }
    	}
    }

    error:

    E:\GTA.San.Andreas\SERVER\filterscripts\HS.pwn(144) : warning 213: tag mismatch
    E:\GTA.San.Andreas\SERVER\filterscripts\HS.pwn(144) : error 001: expected token: ",", but found "["
    E:\GTA.San.Andreas\SERVER\filterscripts\HS.pwn(144) : warning 215: expression has no effect
    E:\GTA.San.Andreas\SERVER\filterscripts\HS.pwn(144) : error 001: expected token: ";", but found "]"
    E:\GTA.San.Andreas\SERVER\filterscripts\HS.pwn(144) : error 029: invalid expression, assumed zero
    E:\GTA.San.Andreas\SERVER\filterscripts\HS.pwn(144) : fatal error 107: too many error messages on one line
     

  7. there i have test a FS to make an interior list with dialog style listitem every thing worked correctly but one part of FS will switch and changed with the main game mode code

    FS code work and dialogs showed to player

    this part work correctly - cmd->inlist->      ShowPlayerDialog(playerid, D_IM, DIALOG_STYLE_LIST, "List Interior ha","Manazel", "Entekhab", "Khorooj");

    this part work correctly - if dialog id = D_IMand select item 0 and response > ShowPlayerDialog(playerid, D_MANAZEL, DIALOG_STYLE_LIST, "List Interior ha","Emarat\nmamuli\nkuchik", "Entekhab", "Khorooj");

    this part is problem!!! -  - if dialog id = D_MANAZEL and select item 0 and response > ShowPlayerDialog(playerid, D_MANEMARAT, DIALOG_STYLE_LIST, "List Interior ha","maddog", "Entekhab", "Khorooj"); "exit");

    after player choose Emarat on D_MANAZEL dialog,then D_MANEMARAT must showed to player but it wont run and the login wrong password of main GM showed.!

    there is enum and ondialog response of main GM:

    enum
    {
    	DIALOG_UNUSED,
    	DIALOG_LOGIN,
    	DIALOG_REGISTER,
    };
    public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
    {
    	switch (dialogid)
    	{
     // Useful for dialogs that contain only information and we do nothing depending on whether they responded or not
    		case DIALOG_LOGIN:
    		{
    			if (!response) return Kick(playerid);
    			new hashed_pass[65];
    			SHA256_PassHash(inputtext, Player[playerid][Salt], hashed_pass, 65);
    			if (strcmp(hashed_pass, Player[playerid][Password]) == 0)
    			{
    				//correct password, spawn the player
    				ShowPlayerDialog(playerid, DIALOG_UNUSED, DIALOG_STYLE_MSGBOX, "Login", "You have been successfully logged in.", "Okay", "");
    				KillTimer(Player[playerid][LoginTimer]);
    				Player[playerid][LoginTimer] = 0;
    				Player[playerid][IsLoggedIn] = true;
    				// spawn the player to their last saved position after login
    				SetSpawnInfo(playerid, NO_TEAM, 0, Player[playerid][X_Pos], Player[playerid][Y_Pos], Player[playerid][Z_Pos], Player[playerid][A_Pos], 0, 0, 0, 0, 0, 0);
    				SpawnPlayer(playerid);
    			}
    			else
    			{
    				Player[playerid][LoginAttempts]++;
    				if (Player[playerid][LoginAttempts] >= 3)
    				{
    					ShowPlayerDialog(playerid, DIALOG_UNUSED, DIALOG_STYLE_MSGBOX, "Login", "You have mistyped your password too often (3 times).", "Okay", "");
    					DelayedKick(playerid);
    				}
    				else ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Wrong password!\nPlease enter your password in the field below:", "Login", "Abort");
    			}
    		}
    		case DIALOG_REGISTER:
    		{
    			if (!response) return Kick(playerid);
    			if (strlen(inputtext) <= 5) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Registration", "Your password must be longer than 5 characters!\nPlease enter your password in the field below:", "Register", "Abort");
    			// 16 random characters from 33 to 126 (in ASCII) for the salt
    			for (new i = 0; i < 16; i++) Player[playerid][Salt][i] = random(94) + 33;
    			SHA256_PassHash(inputtext, Player[playerid][Salt], Player[playerid][Password], 65);
    			// sends an INSERT query
    			orm_save(Player[playerid][ORM_ID], "OnPlayerRegister", "d", playerid);
    		}
    		default: return 0; // dialog ID was not found, search in other scripts
    	}
    	return 1;
    }

     

    and there is my target FS code:

    enum
    {
    D_IM,
    D_MANAZEL,
    D_MANEMARAT
    };
    
    public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
    {
    	switch (dialogid)
    	{
    	 case D_IM:
    	 {
    	  if(response)
    	  {
           switch(listitem)
    	   {
        	case 0 : ShowPlayerDialog(playerid, D_MANAZEL, DIALOG_STYLE_LIST, "List Interior ha","Emarat\nmamuli\nkuchik", "Entekhab", "Khorooj");
    	   }
    	  }
    	 }
    	 case D_MANAZEL:
    	 {
    	  if(response)
    	  {
           switch(listitem)
    	   {
        	case 0 : ShowPlayerDialog(playerid, D_MANEMARAT, DIALOG_STYLE_LIST, "List Interior ha","maddog", "Entekhab", "Khorooj");
    	   }
    	  }
    	 }
    	 case D_MANEMARAT:
    	 {
    	  if(response)
    	  {
           switch(listitem)
    	   {
        	case 0 : Playertptoint(playerid, 1267.663208, -781.323242, 1091.906250, 5);
    	   }
    	  }
    	 }
    	}
    	return 0;
    }

     

  8. hello i have an error when i wanna get information from my enum

    #define MAX_HOUSES 1000

    enum het
    {

        Float:henp[3],
        Float:hexp[3]

    };

    new hinf[MAX_HOUSES][het];

    this two var is on my enum

    and its line

            cache_get_value_name_float(i, "ExteriorX", hinf[i][henp[0]]);     
            cache_get_value_name_float(i, "ExteriorY", hinf[i][henp[1]]);
            cache_get_value_name_float(i, "ExteriorZ", hinf[i][henp[2]]);

    error

    E:\GTA.San.Andreas\SERVER\filterscripts\HS.pwn(109) : error 028: invalid subscript (not an array or too many subscripts): "henp"

    whats this error and why it showed

  9. at this line we have :

     

    mysql_tquery(g_SQL, "CREATE TABLE IF NOT EXISTS `players` (`id` int(11) NOT NULL AUTO_INCREMENT,`username` varchar(24) NOT NULL,`password` char(64) NOT NULL,`salt` char(16) NOT NULL,`kills` mediumint(8) NOT NULL DEFAULT '0',`deaths` mediumint(8) NOT NULL DEFAULT '0',`x` float NOT NULL DEFAULT '0',`y` float NOT NULL DEFAULT '0',`z` float NOT NULL DEFAULT '0',`angle` float NOT NULL DEFAULT '0',`interior` tinyint(3) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), UNIQUE KEY `username` (`username`))");
       

    now if i add another part to this code like 'Alevel' tinyint(3) or every more case for adding new table compiler give me error :

    error 075: input line too long (after substitutions)

    error 037: invalid string (possibly non-terminated string)

    why it happen and how i can fix and add my values or create new values

  10. hello all 

    am about to create an rp gamemode and i just aware there is a new system named ORM that meke easy all db side codings.

    please link any forum that have information about it

    our please show me simple usages/command/syntaxe

    that will help me to grow my game mode.

    i have some basic knowledge on samp pawn coding

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