Little coding questions - For general minor queries 5

Does rcon banip natively check if the input is a valid ip address before banning it?
Reply

Hi guys!

I am wondering about the "ParseFile" function in Y_Ini;

is this the right way to read from a tag which is named "Baninfo" from the playerfile ?

pawn Код:
INI_ParseFile(INI_PATH(playerid),"Baninfo_%s", .bExtra = true, .extra = playerid);
?

Or did i totally misunderstand what ParseFile does?

Thanks ^^
Reply

Quote:
Originally Posted by airplanesimen
Посмотреть сообщение
Hi guys!

I am wondering about the "ParseFile" function in Y_Ini;

is this the right way to read from a tag which is named "Baninfo" from the playerfile ?

pawn Код:
INI_ParseFile(INI_PATH(playerid),"Baninfo_%s", .bExtra = true, .extra = playerid);
?

Or did i totally misunderstand what ParseFile does?

Thanks ^^
The string format (%s) represents all tags. If you have two tags - 'tag1' and 'tag2', there will be maximum two callbacks: Baninfo_tag1 and Baninfo_tag2.
Reply

I have one question. I created dialog which allows you to select team and class, but when I pressing "Select" button with my mouse after spawn it's working, but when I pressing enter to confirm its doesn't working.
Code:
Код:
public OnPlayerRequestClass(playerid, classid)
{
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Teams", "\nUnited States Of America\nGermany\nRussia\nItaly", "Select", "Exit");
return 1;
}
 
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 2)
    {
        if(response) // If they clicked 'Yes' or pressed enter
        {
            if(listitem == 0){
			gTeam[playerid] = TEAM_USA;
			SetPlayerColor(playerid,COLOR_BLUE);
			ShowPlayerDialog(playerid, 3, DIALOG_STYLE_LIST, "Classes", "\nSoldier\nSniper\nEngineer\nPilot", "Select", "Exit");
			}
			if(listitem == 1){
			gTeam[playerid] = TEAM_GERMANY;
			SetPlayerColor(playerid,COLOR_ORANGE);
			ShowPlayerDialog(playerid, 3, DIALOG_STYLE_LIST, "Classes", "\nSoldier\nSniper\nEngineer\nPilot", "Select", "Exit");
		    }
			if(listitem == 2){
			gTeam[playerid] = TEAM_RUSSIA;
			SetPlayerColor(playerid,COLOR_RED);
			ShowPlayerDialog(playerid, 3, DIALOG_STYLE_LIST, "Classes", "\nSoldier\nSniper\nEngineer\nPilot", "Select", "Exit");
			}
			if(listitem == 3){
			gTeam[playerid] = TEAM_ITALY;
			SetPlayerColor(playerid,COLOR_YELLOW);
			ShowPlayerDialog(playerid, 3, DIALOG_STYLE_LIST, "Classes", "\nSoldier\nSniper\nEngineer\nPilot", "Select", "Exit");
			}
        }
        else // Pressed ESC or clicked cancel
        {
            SendClientMessage(playerid, COLOR_RED, "You left the server");
            Kick(playerid);
        }
        return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
    }
    if(dialogid == 3)
    {
        if(response) // If they clicked 'Yes' or pressed enter
        {
            if(listitem == 0){
            TogglePlayerSpectating(playerid, 0);
			SendClientMessage(playerid, COLOR_RED, "Soldier");
			SpawnPlayer(playerid);
			GivePlayerWeapon(playerid, 12,1000);
			}
			if(listitem == 1){
			SendClientMessage(playerid, COLOR_RED, "Sniper");
			SpawnPlayer(playerid);
			}
			if(listitem == 2){
			SendClientMessage(playerid, COLOR_RED, "Engineer");
			SpawnPlayer(playerid);
			}
			if(listitem == 3){
			TogglePlayerSpectating(playerid, 0);
			SendClientMessage(playerid, COLOR_RED, "Pilot");
			SpawnPlayer(playerid);
			}
        }
        else // Pressed ESC or clicked cancel
        {
            SendClientMessage(playerid, COLOR_RED, "You left the server");
            Kick(playerid);
        }
        return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
    }
}
Reply

With the new MySQL R7/R8 caching functions, is there a possibility for the script to wait until the public callback function finishes without losing too much time (or make it return a value without using global variables and clear the cache aswell)? I want to keep the code together in one place and not make the script into a system of "stairs", if you get what I mean. For example, when the user logs in I want to check if the account exists, query the password, wait until he types in the password, compare the password with the one queried earlier and then query all the user stats and information (possibly do the stats querying while he types in the password). With caching, only the very first query will be in the "OnPlayerConnect" callback (checking if the account exists) and everything else is just everywhere around the code (in other public callbacks and so on) and keeping the code readable with 100k+ lines is a must for me (querying vehicles and other huge amounts of data takes time and that's where I intend to use the caching, but when I need to just get one row, then another row from somewhere else and then wait for user input, the time loss would be unnoticeable). Using a stair of callbacks would be readable in small scripts, but not when I have 150+ queries that are used together with 1/3 of the script.
Reply

Howdy, is it possible to remove this SA:MP added object? Doesn't exist in original map. Singleplayer garage in Las Venturas.

http://www.upload.ee/image/3050636/sa-mp-504.png
Thanks.
Reply

Guys again, Does anyone knows this Object ID? ( i mean the smoke in the pic above )

Reply

Quote:
Originally Posted by SilverKiller
Посмотреть сообщение
Guys again, Does anyone knows this Object ID? ( i mean the smoke in the pic above )

The picture is way too small to see anything there. Upload it in a bigger resolution.
Reply

Hi guys,
I need to know how to make a timed moving object with a timer. I was searching in samp wiki but I did not find it
Can anyone explain the code to me?
Reply

Quote:
Originally Posted by DiGiTaL_AnGeL
Посмотреть сообщение
The picture is way too small to see anything there. Upload it in a bigger resolution.
Ok here:

Reply

Quote:
Originally Posted by SilverKiller
Посмотреть сообщение
Ok here:

It's not smoke, its a smoke machine in the human i guess, the object ID is 2780
Reply

Quote:
Originally Posted by Hade.
Посмотреть сообщение
It's not smoke, its a smoke machine in the human i guess, the object ID is 2780
Maybe Yes, But the smoke of the smoke machine causes Lagg, this doesnt
Reply

Quote:
Originally Posted by KP2
Посмотреть сообщение
Hi guys,
I need to know how to make a timed moving object with a timer. I was searching in samp wiki but I did not find it
Can anyone explain the code to me?
Would someone answer my question now??
Reply

Quote:
Originally Posted by KP2
Посмотреть сообщение
Would someone answer my question now??
Timed moving object with a timer? What exactly don't you understand? You know you want to move the object, and you know you want it timed with a timer.

SetTimerEx
MoveObject
Reply

Quote:
Originally Posted by LarzI
Посмотреть сообщение
Timed moving object with a timer? What exactly don't you understand? You know you want to move the object, and you know you want it timed with a timer.

SetTimerEx
MoveObject
Exactly!
I want you to explain the code to me please..
Reply

Quote:
Originally Posted by KP2
Посмотреть сообщение
Exactly!
I want you to explain the code to me please..
Example :

pawn Код:
new obj; // at the top
pawn Код:
SetTimerEx("MovingThisObject", 1000, false, "i", playerid);
 // 1000 is 1 second, choose what you want , Note that the move object will happen 1 second or whatever you typed in seconds.
pawn Код:
// Under OnGameModeInIt
obj = CreateObject(modelid, Float:X, Float:Y, Float:Z, Float:rX, Float:rY, Float:rZ); // Creates The Object
And the callback:

pawn Код:
forward MovingThisObject(playerid);
public MovingThisObject(playerid)
{
    MoveObject(obj, Float:X, Float:Y, Float:Z); // Moves the object to the XYZ you typed.
    return 1;
}
Reply

Is it possible with just SetTimer?
Reply

Quote:
Originally Posted by KP2
Посмотреть сообщение
Is it possible with just SetTimer?
Yes,

pawn Код:
SetTimer("MovingThisObject", 1000, false);
pawn Код:
forward MovingThisObject();
public MovingThisObject()
{
    MoveObject(obj, Float:X, Float:Y, Float:Z);
    return 1;
}
Reply

I am not sure if this is a coding question. But I wanted a ''info box'' filterscript. That would be a filterscript, with functions with which you can create textdraw boxes and so on. I searched and found one called "Shadows info box creator" But I don't like it. I had found one .. made by Mauzen or something, I do not remember!
I would like it if someone can remember it and link me to it, I need it to show help in a textdraw forms to different classes/teams.
Reply

Quote:
Originally Posted by ******
Посмотреть сообщение
Have you tried taking the one you don't like and changing the TD styles (possibly using the TD editor)?
Yes I tried, but the whole text color and thing's messed up, completely opposite of what I like. It would rather be better if I create my own FS :/ Anyways, if someone does remember, please do PM/visitor message me.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)