Little coding questions - For general minor queries 5

Is there a way to read the Dialog info and save it in a variable ? Dialog Style is Listitem the problem here is that i cannot use the listitem id i need the info from the listitem itself (string)
Reply

How can I call a OnPlayerTakeDamage function with a command?
Reply

pawn Code:
CallLocalFunction("OnPlayerTakeDamage", "ddf", playerid, targetid, damage);
You need a way to define targetid and damage, though.
Reply

Okay I was just stupid... Can someone please go in pawno editor (pawno.exe), press "Options" and then press "Fonts" and tell me which the default one is? I screwed up haha. Please help me xD
Reply

Quote:
Originally Posted by Hansrutger
View Post
Okay I was just stupid... Can someone please go in pawno editor (pawno.exe), press "Options" and then press "Fonts" and tell me which the default one is? I screwed up haha. Please help me xD
Font_Name=Courier New
Reply

Two questions:

INI_ParseFile
Let us say you have a function like this:
pawn Code:
loadsomething(a, b, name[], value[])
{
//code
}
How can you with INI_ParseFile pass on both a variable a and a variable b?
pawn Code:
INI_ParseFile("m.ini", "loadsomething", .bExtra = true, .extra = a);
Can you just add like: "a, b"?


Arrays
Using a 3-dimensional arrays, as I have heard, are heavy when it comes to taking up space. How much, I do not know but I've heard that. Is there anything similar to 3-dimensional arrays that wouldn't take up as much space? Might be a stupid question, but just asking. ^^
Reply

i am using https://sampforum.blast.hk/showthread.php?tid=446286 but when i try make the object work and do things, the object moves slowly, a bit laggy. idk what happened. Can u help me?
Reply

Quote:
Originally Posted by Hansrutger
View Post
How can you with INI_ParseFile pass on both a variable a and a variable b?
The only way I know is that you create an array and pass the address but that only works for local functions
Quote:
Originally Posted by Hansrutger
View Post
Arrays
Using a 3-dimensional arrays, as I have heard, are heavy when it comes to taking up space. How much, I do not know but I've heard that. Is there anything similar to 3-dimensional arrays that wouldn't take up as much space? Might be a stupid question, but just asking. ^^
There is nothing else and memory does't matter nowadays, extra memory doesn't slow your gamemode down
Reply

1 question:
Will there be a problem if i use MySql And y_ini (i won't use both to store the same data, but different one)

Other: If possible answer my prev question.
Reply

can u answer the question above that? i'm stuck with it
Reply

Quote:
Originally Posted by newbie scripter
View Post
i am using https://sampforum.blast.hk/showthread.php?tid=446286 but when i try make the object work and do things, the object moves slowly, a bit laggy. idk what happened. Can u help me?
Bump..
Reply

Quote:
Originally Posted by Crucial
View Post
How do I set that everyone would run/walk in the style where when you sprint its quite slow and you move your arms back and forth instead of the default CJ run?
What you mentioned is actually default, to get CJ run you need to use the function UsePlayerPedAnims. Remove that function call from your script and you'll get the slow sprint animations.

Quote:
Originally Posted by CrossUSAAF
View Post
@[HLF]Southclaw:

Thanks for your reply. Is it recommendable to use "char" arrays in format, if I Use values only between 0 and 255?
Yeah, if you are definitely sure that you won't be using values over 255 (for ASCII text) then use it. (I can't think of any reason not to use it at the moment)
Reply

Does anybody know why this plugin does not work anymore?

https://sampforum.blast.hk/showthread.php?tid=274294

It gives fails when will be loaded. Tried another FTP plugin but I not found.
Reply

Hey there!

Today I Came here to ask a little coding question regarding "&" bitwise operator or character what I Have seen on some functions before. What is this called and what it does? There is short example below:

pawn Code:
public function(&a, &b) {
// ...
}
Thanks for your reply in advance!
Reply

In that case it tells the function that this variable should be passed by reference

That means if you change the variable inside the function it will also change outside
pawn Code:
main() {
    new
        var1 = 3,
        var2 = 3
    ;
    MyFunc(var1, var2);

    printf("%d, %d", var1, var2); // 3, 5
}

MyFunc(value, & reference) {
    value = 5;
    reference = 5;
}
Array are always passed by reference
Reply

Great answer Nero_3D, I Got it instantly!
Reply

Hello,

I'm looking for list of SA-MP sprites. I have tried Lorenc_'s sprite browser, but it didn't worked. Can you help me to find the list or working software?
Reply

I have a problem in a zcmd command will changes the player skin.

here is the code :

PHP Code:
CMD:player_skin(playeridparams[])
{
    new 
skinid;
    if (
sscanf(params"i"skinid))
    {
        return 
SendClientMessage(playerid0xBE6C97FF"Usage: /skin <skinid>");
    }
    if (
skinid 299)
    {
        
SendClientMessage(playerid0x5A00FFFF"u can't use");
        return 
0;
    }
    
SetPlayerSkin(playeridskinid);
    return 
1;

if the player types /player_skin gets "Usage: /skin <skinid>" this one is correct
if player types /player_skin 0~299 changes the skin this one is correct

BUT if typed a number greater than 299 (e.g 300) types "u can't use" but types a line which writed "SERVER: Unknown command."

i want just write "u cant use" without the error (SERVER: Unknown command.).
if the return changed to 1 game crashes.
Reply

Returning 0 on a command function will result in that "Unknown command" message.
Setting that to 1 will remove the error. I'm not sure how that can crash the game, are you sure you don't mean the server crashes?
Reply

thanks fixed
Reply


Forum Jump:


Users browsing this thread: 13 Guest(s)