SA-MP Forums Archive
Public Help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Public Help (/showthread.php?tid=497561)



Public Help - Max_Andolini - 27.02.2014

public deger values ​​does not work help!!


Код:
Antiopen(playerid,"ANTI_CRASHER","Anti_Crasher","Anti Crasher","Anti Crasher"); // Deger is "ANTI_CRASHER"
Код:
forward Antiopen(playerid,deger[],const dini[],const turkce2[], const english2[]);
public Antiopen(playerid,deger[],const dini[],const turkce2[],const english2[])
{
	new str[100],file[256],string[144],string2[144];
    PlayerPlaySound(playerid, 1056, 0.0, 0.0, 0.0);
    if(deger[30] == 1){ // value does not work
    #if LANGUAGE == 0
	format(string, sizeof(string), "%s Zaten Aktif.",turkce2);
    return Hatatr(playerid,string);
    #elseif LANGUAGE == 1
	format(string, sizeof(string), "%s Already Active.",english2);
    return Hataen(playerid,string);
    #endif
    }
    deger[30] = 1; // value does not work
    #if MYSQL_KAYIT == true
    MySQLguncelle(),MySQLguncelle2();
    #elseif NORMAL_KAYIT == true
    format(str,sizeof(str),"%s",dini);
    format(file,sizeof(file),"Anti_Hile/Ayarlar.ini");
    dini_IntSet(file,str,1);
    #endif
    #if LANGUAGE == 0
	format(string2, sizeof(string2), "%s Başarıyla Aktif Edildi.", turkce2);
    Bilgitr(playerid,string2);
    #elseif LANGUAGE == 1
	format(string2, sizeof(string2), "%s Has Been Succesfully Activated.", english2);
    Bilgien(playerid,string2);
    #endif
    return 1;
}



Re: Public Help - Max_Andolini - 27.02.2014

Bump #1


Re: Public Help - PowerPC603 - 28.02.2014

Quote:
Originally Posted by eco1999
Посмотреть сообщение
public deger values ​​does not work help!!


Код:
Antiopen(playerid,"ANTI_CRASHER","Anti_Crasher","Anti Crasher","Anti Crasher"); // Deger is "ANTI_CRASHER"
Код:
forward Antiopen(playerid,deger[],const dini[],const turkce2[], const english2[]);
public Antiopen(playerid,deger[],const dini[],const turkce2[],const english2[])
{
	new str[100],file[256],string[144],string2[144];
    PlayerPlaySound(playerid, 1056, 0.0, 0.0, 0.0);
    if(deger[30] == 1){ // value does not work
}
That's understandable.

You're passing a string to your function: "ANTI_CRASHER".
This string is only 12 characters long.

Your code "if (deger[30] == 1" checks the 30th character to be equal to integer value "1".
Deger has been initialized with only size 13 (your string and NULL character) and you try to access character 30, which gives you an out-of-bounds error.


Re: Public Help - Max_Andolini - 28.02.2014

Quote:
Originally Posted by PowerPC603
Посмотреть сообщение
That's understandable.

You're passing a string to your function: "ANTI_CRASHER".
This string is only 12 characters long.

Your code "if (deger[30] == 1" checks the 30th character to be equal to integer value "1".
Deger has been initialized with only size 13 (your string and NULL character) and you try to access character 30, which gives you an out-of-bounds error.
That's why I made it available in different use

Sample

Antiopen(playerid,"ANTI_CRASHER","Anti_Crasher","A nti Crasher","Anti Crasher");
Antiopen(playerid,"ANTI_CON","Anti_Con","Anti Con","Anti Con");
Antiopen(playerid,"ANTI_PING","Anti_Ping","Anti Ping","Anti Ping");
Antiopen(playerid,"ANTI_SILAH","Anti_Silah","Anti Silah","Anti Weapon");


Re: Public Help - Konstantinos - 28.02.2014

What do you want to do anyways? Why do you check the index 30 of deger if it's equal to 1?


Re: Public Help - Max_Andolini - 01.03.2014

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
What do you want to do anyways? Why do you check the index 30 of deger if it's equal to 1?
I want to do public work


Re: Public Help - Max_Andolini - 01.03.2014

Bump #2


Re: Public Help - Konstantinos - 01.03.2014

Quote:
Originally Posted by eco1999
Посмотреть сообщение
I want to do public work
What you're saying makes no sense and so the code does. What "public work" is supposed to be? By checking a random index from a string (array) is useless and as PowerPC603 already said can cause run time error: Array index out of bounds.


Re: Public Help - Max_Andolini - 01.03.2014

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
What you're saying makes no sense and so the code does. What "public work" is supposed to be? By checking a random index from a string (array) is useless and as PowerPC603 already said can cause run time error: Array index out of bounds.
I wonder how I can do.Would you do the make code.


- Max_Andolini - 01.03.2014

Bump #3

Bump #4

Bump #5