SA-MP Forums Archive
Little coding questions - For general minor queries 5 - 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: Little coding questions - For general minor queries 5 (/showthread.php?tid=30938)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46


Re: Little coding questions - For general minor queries 5 - Logic_ - 05.05.2017

You can use GPCI for that but it's not reliable.


Re: Little coding questions - For general minor queries 5 - Dayrion - 08.05.2017

Why this is not working?
PHP Code:
#define fac_t:%0    FacType_%0

new fac_t:Gouv
Code:
warning 236: unknown parameter in substitution (incorrect #define pattern)
error 001: expected token: ";", but found "%"



Re: Little coding questions - For general minor queries 5 - Gammix - 08.05.2017

Quote:
Originally Posted by Dayrion
View Post
Why this is not working?
PHP Code:
#define fac_t:%0    FacType_%0
new fac_t:Gouv
Code:
warning 236: unknown parameter in substitution (incorrect #define pattern)
error 001: expected token: ";", but found "%"
PHP Code:
MyTag:
//declarable
new MyTag:var; 
^ This is called a Tag and you cannot declare it in macros.

PHP Code:
MyPrefix::
//defineable
#define MyPrefix::%1 %1_MyPrefix 
This is not a tag.


Re: Little coding questions - For general minor queries 5 - Dayrion - 08.05.2017

Quote:
Originally Posted by Gammix
View Post
PHP Code:
MyTag:
//declarable
new MyTag:var; 
^ This is called a Tag and you cannot declare it in macros.

PHP Code:
MyPrefix::
//defineable
#define MyPrefix::%1 %1_MyPrefix 
This is not a tag.
Ooh. Yes, okei. I'm pretty stupid lol

Mhm, but How does foreach work? Forach has created his own tag? This tag add a new var.


Re: Little coding questions - For general minor queries 5 - Gammix - 08.05.2017

Quote:
Originally Posted by Dayrion
View Post
Ooh. Yes, okei. I'm pretty stupid lol

Mhm, but How does foreach work? Forach has created his own tag? This tag add a new var.
Well if you use bracets, which will force the decelaration to be of that specific syntax everytime, can prevent this error.

If i am not wro g, this should compile:
PHP Code:
#define MyTag:%1<%2> %1@MyTag[%2]
new MyTag:var<100>; 



Re: Little coding questions - For general minor queries 5 - Dayrion - 08.05.2017

Alright, thanks you! +rep


Re: Little coding questions - For general minor queries 5 - Logic_ - 08.05.2017

I found creating a thread for this to be inappropriate, so I thought of asking this question here; I create dynamic CP with the radius of 3.0, but the thing is that even when I'm near my fucking CPs it calls the OnPlayerEnterDynamicCP while I'm not in it. Is there any solution for this fucking problem, this is pissing me off since the past week and I've seen some servers such as RWW where this shit doesn't happen.


Re: Little coding questions - For general minor queries 5 - Logic_ - 09.05.2017

Thanks alot Southclaw.

--
Is there any way to show a 3D text label to a player which is attached to himself? Either using YSF/ SKY or anything?


Re: Little coding questions - For general minor queries 5 - Logic_ - 09.05.2017

* Ali is speechless after seeing Gamer_Z's post *
(( Waiting for others to roleplay ))

I'd look more deeper into this tomorrow, gotta sleep today :P


Re: Little coding questions - For general minor queries 5 - Hansrutger - 11.05.2017

Any technical reason why there's no GetVehicleInterior function? Ye ye, I know I can just save the interiorid to an array of vehicles whenever I set a vehicle's interior, but that's not my question. Was just curious if there was an issue in SA-MP that made the function never to be existing?


Re: Little coding questions - For general minor queries 5 - denNorske - 11.05.2017

Quote:
Originally Posted by Hansrutger
Посмотреть сообщение
Any technical reason why there's no GetVehicleInterior function? Ye ye, I know I can just save the interiorid to an array of vehicles whenever I set a vehicle's interior, but that's not my question. Was just curious if there was an issue in SA-MP that made the function never to be existing?
Probably because it wasn't thought of. I don't see how anyone in here would know why except for kalcor


Re: Little coding questions - For general minor queries 5 - Hansrutger - 11.05.2017

People tend to be smarter than me so maybe someone had a theory!


Re: Little coding questions - For general minor queries 5 - Kane - 12.05.2017

Say, a players near a house. When you're near the house, say a checkpoints set at the door. What can I use to do this BUT when you're in it, it doesn't loop and you're not being flickered with checkpoints?

Just an example of what I'm trying to get at.


Re: Little coding questions - For general minor queries 5 - GaByM - 12.05.2017

Anyone knows the ID of the sound that plays on single player when you purchase a house?
I mean this: https://www.youtube.com/watch?v=qBbRd4o1suY


Re: Little coding questions - For general minor queries 5 - Logic_ - 12.05.2017

Hey there, I'm using XAMPP and I'm not able to connect my localhost server to the MySQL DB. Any ideas?


Re: Little coding questions - For general minor queries 5 - iKarim - 12.05.2017

Quote:
Originally Posted by Logic_
Посмотреть сообщение
Hey there, I'm using XAMPP and I'm not able to connect my localhost server to the MySQL DB. Any ideas?
What error message do you get? There's dozen of reasons that you won't be able to connect such as the mysql service isn't started, invalid username/password, ...


Re: Little coding questions - For general minor queries 5 - Dayrion - 12.05.2017

Quote:
Originally Posted by Logic_
Посмотреть сообщение
Hey there, I'm using XAMPP and I'm not able to connect my localhost server to the MySQL DB. Any ideas?
Be sure Skype is closed and Apache & MySQL are actived :



Re: Little coding questions - For general minor queries 5 - Dayrion - 13.05.2017

Hey.
I need to save in database 8 ranks. Like, rank_1, rank_2 ... rank_8.
What is the best way to do this?
Actually ;
PHP код:
CREATE TABLE `---`.`---` ( `---INT NOT NULL AUTO_INCREMENT , `rank_1VARCHAR(35NOT NULL , `rank_2VARCHAR(35NOT NULL , `rank_3VARCHAR(35NOT NULL , `rank_4VARCHAR(35NOT NULL , `rank_5VARCHAR(35NOT NULL , `rank_6VARCHAR(35NOT NULL , `rank_7VARCHAR(35NOT NULL , `rank_8VARCHAR(35NOT NULL PRIMARY KEY (`faction_id`)) ENGINE InnoDB
Edit: Also, loading ranks is painfull :
PHP код:
PUBLIC:OnRanksLoading()
{
    new 
temporaire,
        
nbRank cache_num_rows();
    for(new 
i!= nbRanki++)
    {
        
cache_get_value_int(i"SQLID"temporaire); // SQLID
        
cache_get_value(i"rank_0"f_RankName[temporaire][0], MAX_FAC_RANK_NAME);
        
cache_get_value(i"rank_1"f_RankName[temporaire][1], MAX_FAC_RANK_NAME);
        
cache_get_value(i"rank_2"f_RankName[temporaire][2], MAX_FAC_RANK_NAME);
        
cache_get_value(i"rank_3"f_RankName[temporaire][3], MAX_FAC_RANK_NAME);
        
cache_get_value(i"rank_4"f_RankName[temporaire][4], MAX_FAC_RANK_NAME);
        
cache_get_value(i"rank_5"f_RankName[temporaire][5], MAX_FAC_RANK_NAME);
        
cache_get_value(i"rank_6"f_RankName[temporaire][6], MAX_FAC_RANK_NAME);
        
cache_get_value(i"rank_7"f_RankName[temporaire][7], MAX_FAC_RANK_NAME);
        
cache_get_value(i"rank_8"f_RankName[temporaire][8], MAX_FAC_RANK_NAME);
    }




Re: Little coding questions - For general minor queries 5 - [HLF]Southclaw - 13.05.2017

You only need a column per-property if things can occupy multiple.
If your ranks are only occupied by things one at a time, just use a single "rank" column and drop a number in there that represents the rank.
I'm not entirely sure what you're aiming to do though, so some more information would be good.


Re: Little coding questions - For general minor queries 5 - Dayrion - 13.05.2017

Alright, so ranks each ranks (min 6, max 8 ) are named by the owner. Of course, I need to save each rank's name.
rank_0 is the 0 rank's name. 1 is for 1, etc...

EDIT;
#define variable isn't considered as a constant?