Little coding questions - For general minor queries 5

is it the parameter called float:distance?
Reply

yes.
Reply

but I use convertffs , and with the convert there were no streamdistances give.. so what's the default streamdistance, so I know when I'm lower than the default or not
Reply

Idk if this is the perfect place to ask but wht is the best way to prevent players from jacking whitout killing the jacker?
Reply

ClearAnimations();
Reply

I don't know where the failure is. I scripted on OnPlayerEnterVehicle:
Код:
if(GetVehicleModel(vehicleid) == 400)
	{
	    if(landstal == false)
	    {
	        landstal = true;
	        SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
	        return 0;
		}
		else return 1;
	}
I scripted landstal as a boolean before:
Код:
new bool:landstal;
It should only one time give score +1; only when entering the vehicle for the first time, but it's giving score on every enter. What did I wrong?
Reply

i've got the newbiest question of them all, what is != for instanst, pvar, in my settings i set pvar!=1 (was originally 0 ) and in my script i found the functions for it, says if (getPVarInt(playerid, "PVarmoney") !=0 would i set all corresponding code like the above to match my settings to allow cross filterscript money transfer?
Reply

Quote:
Originally Posted by xZacharias
Посмотреть сообщение
I don't know where the failure is. I scripted on OnPlayerEnterVehicle:
Код:
if(GetVehicleModel(vehicleid) == 400)
	{
	    if(landstal == false)
	    {
	        landstal = true;
	        SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
	        return 0;
		}
		else return 1;
	}
I scripted landstal as a boolean before:
Код:
new bool:landstal;
It should only one time give score +1; only when entering the vehicle for the first time, but it's giving score on every enter. What did I wrong?
pawn Код:
public OnPlayerStateChange(playerid,newstate,oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
        if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 400)
        {
            if(!landstal)
            {
                landstal = true;
                SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
            }
        }
    }
    return 1;
}
Try it that way.
Reply

Hey. I have a self made register / login system with dialogs. The thing is, if I enter a wrong password in the dialog, it spawns my character at 0 0 0 coords ... But the dialog doesn't disappear. How can I make it that if I enter a wrong password, it won't spawn me ?
pawn Код:
public OnPlayerConnect(playerid)
{
    if(fexist(UserPath(playerid)))
    {
        INI_ParseFile(UserPath(playerid), "LoadPassword_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, 2, DIALOG_STYLE_PASSWORD,""CWH"Login",""CWH"Introdu parola mai jos pentru a te loga.","Login","Quit");
    }
    else
    {
        ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT,""CWH"Inregistrare...",""CWH"Introdu o parola mai jos pentru a-ti crea un account.","Inregistreaza","Iesi");
    }
    return 1;
}
Reply

Using two different MYSQL plugin can cause any problem?
Reply

Anyone knows how to make a ZCMD "Warn-Command"?
Reply

Is it possible to set all(or a scope of) items to a same value in an array in one line, without using loops? It would be fine if it was a small array, but my code has
pawn Code:
onevariable[MAX_PLAYERS][MAX_PLAYERS]
so it's quite large and needs to be updated on OnPlayerDeath() callback. I need to set all the values or all but one value to 0, so it would be something like
pawn Code:
onevariable[all items][all items] = 0
Reply

Slice wrote a "memset" function using the p-code "FILL" OpCode:

http://forum.sa-mp.com/showthread.ph...et#post1606781

But ultimately this still uses a loop internally (though a C loop so it should be faster). You can modify this to take a reference to "data[0][0]" and "len1 * len2" as the size.
Reply

I want it to only set SWAT's armour to 100, but it also gives the Murderer 100 armour.

pawn Code:
if (gTeam[playerid] == SWAT){
SetPlayerArmour(playerid, 100);
}
Reply

TextDrawHideForPlayer() doesn't work for some reason. When I type in "/show" it shows the textdraw and the message in chat, but when I type in "/hide" it only shows the message in chatbox and doesn't hide the textdraw. Here's the code:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new Text:debugtext;
    debugtext = TextDrawCreate(320,320,"debug");
    if(!strcmp(cmdtext, "/show", true))
    {
        TextDrawShowForPlayer(playerid, debugtext);
        SendClientMessage(playerid, 0xFFFFFFFF, "textdraw on");
        return 1;
    }
    if(!strcmp(cmdtext, "/hide", true))
    {
        TextDrawHideForPlayer(playerid, debugtext);
        SendClientMessage(playerid, 0xFFFFFFFF, "textdraw off");
        return 1;
    }
}
Reply

Thats because you create the textdraw each time you call OnPlayerCommandText
The first time it creates and shows it
The second time it creates a new one and hides it (although it was already hidden)
In the end the first one is still beeing shown

Textdraws are generally generated in OnGameModeInit and they use global variables

pawn Код:
// Global
stock
    Text: debugtext
;
pawn Код:
// OnGameModeInit
    debugtext = TextDrawCreate(320.0, 320.0, "debug");
pawn Код:
// OnPlayerCommandText
    if(!strcmp(cmdtext, "/debug", true)) {
        static
            bool: show
        ;
        if((show = !show)) {
            TextDrawShowForPlayer(playerid, debugtext);
            SendClientMessage(playerid, 0xFFFFFFFF, "textdraw on");
        } else {
            TextDrawHideForPlayer(playerid, debugtext);
            SendClientMessage(playerid, 0xFFFFFFFF, "textdraw off");
        }
        return true;
    }
Reply

Quote:
Originally Posted by Nero_3D
Посмотреть сообщение
Textdraws are generally generated in OnGameModeInit and they use global variables
Thank you for an explanation , works fine now
Reply

Quote:
Originally Posted by admantis
Посмотреть сообщение
I made a big gamemode with a "core" timer that handles every player operation requiring timing. The interval is 1000 ms, and debugging I found out that only by myself (it has a few of foreach loops and stuff) the whole timer (about 1000 lines of code!) takes 2-3 ms to be called.

Will this present problems on the future when I have about 40 or even 50 players?
3*50 is 150MS, so no..
Reply

I've a problem which I don't know how to solve.

I'm using GetPlayerWeaponState to avoid M4 reload animation, but the problem is it doesn't get called if the player is not moving.

For example, if I move forward or I release KEY_FIRE it will get called, otherwhise it will not.

Код:
if(GetPlayerWeapon(playerid) == 31 && GetPlayerWeaponState(playerid) == WEAPONSTATE_LAST_BULLET)
{
  	GivePlayerWeapon(playerid, 31, 49);
}
If an animation is applied and quickly cleared, reloading animation will be bypassed in the following way.

Quote:
Originally Posted by Infinite "loop"
Bypass
Reload
Bypass
Reload
Any ideas on how to do this in an efficient way? Thank you.
Reply

Hello, how can I do (using Incognito's streamer plugin) that a dynamic object will show in every interior, except for 0?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)