SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 11/08/2017, 01:35 AM   #4341
Paulice
Huge Clucker
 
Paulice's Avatar
 
Join Date: Jul 2017
Posts: 282
Reputation: 30
Default Re: Little coding questions - For general minor queries 5

Y_INI from YSI 4 seems to save data in descending order. Is this normal? If so, are there any benefits; hence, the change?


Paulice is offline   Reply With Quote
Old 11/08/2017, 01:45 AM   #4342
Misiur
High-roller
 
Misiur's Avatar
 
Join Date: Jul 2009
Location: Poland
Posts: 2,314
Reputation: 488
Default Re: Little coding questions - For general minor queries 5

Yes, it's normal. As for benefits as best as Y_Less on github
Misiur is offline   Reply With Quote
Old 11/08/2017, 03:34 PM   #4343
Dayrion
High-roller
 
Dayrion's Avatar
 
Join Date: Jan 2016
Posts: 1,335
Reputation: 106
Default Re: Little coding questions - For general minor queries 5

Is it better to create and destroy textdraw or create it one time and show/hide when it's needed?
Dayrion is offline   Reply With Quote
Old 11/08/2017, 04:41 PM   #4344
Vince
Spam Machine
 
Vince's Avatar
 
Join Date: Sep 2007
Location: Belgium
Posts: 10,941
Reputation: 2586
Default Re: Little coding questions - For general minor queries 5

I don't see the point in recreating them, honestly. More function calls, thus slower.
__________________
Vince is offline   Reply With Quote
Old 11/08/2017, 04:58 PM   #4345
ISmokezU
Gangsta
 
Join Date: Aug 2016
Posts: 519
Reputation: 53
Default Re: Little coding questions - For general minor queries 5

B.

Create one time and show/hide them.

Like Vince said Recreating them over n over is useless and you wouldn't want to do that, it will catch up on you if you intend to use a lot of textdraws.
__________________
Quote:
Originally Posted by Paulice View Post
Create a server that let's players create a server! SA-MP will continue to live on!!! Viva la samp!
ISmokezU is online now   Reply With Quote
Old 12/08/2017, 01:39 PM   #4346
GaByM
Little Clucker
 
GaByM's Avatar
 
Join Date: Jan 2014
Posts: 49
Reputation: 0
Default Re: Little coding questions - For general minor queries 5

Quote:
Originally Posted by Spmn View Post
Thank you!

Quote:
Originally Posted by Jeroen52 View Post
Do you have some examples?
Yes, I have
PHP Code:
CMD:coin(playerid,params[])
{
    new 
random(600), s[100];
    
strcat(s,"* ");
    
strcat(s,nume[playerid]);
    if(
== 0)
        
strcat(s" has thrown the coin and landed on the edge.");
    else
    {   
random(100);
        if(
50)
            
strcat(s," has thrown the coin and landed on the head side.");
        else
            
strcat(s," has thrown the coin and landed on the tail side.");
    }
    
sendArea(playerid20CP3s);
    return 
1;

Sometimes, this gives the same result in a row (head/tail). I know that something random is supposed to be like that, but 8-9 times in a row? Maybe it is my fault because I used a big number (100), maybe I should use a smaller interval (0 to 10? or to 2?), but anyway, is not such a big deal with /coin cmd, it is just trivial.

I plan to make a lottery/roulette system (sometime), and I didn't wanted to use random for the reason previously mentioned, but as you said random is random so I am going to use sa:mp's native, at least for now.
__________________
Sorry for my bad English.
GaByM is offline   Reply With Quote
Old 12/08/2017, 03:16 PM   #4347
oMa37
Gangsta
 
oMa37's Avatar
 
Join Date: Feb 2016
Posts: 973
Reputation: 136
Default Re: Little coding questions - For general minor queries 5

What could cause calling the OnPlayerDeath twice? In my gamemode it seems like it's getting called twice when the player dies in event/minigame.

EDIT: Well, It looks like it's calling like this: OnPlayerDeath -> OnPlayerSpawn -> OnPlayerDeath -> OnPlayerRequestClass -> OnPlayerSpawn
oMa37 is offline   Reply With Quote
Old 12/08/2017, 03:40 PM   #4348
Sew_Sumi
High-roller
 
Join Date: Jun 2008
Posts: 4,715
Reputation: 323
Default Re: Little coding questions - For general minor queries 5

Quote:
Originally Posted by oMa37 View Post
What could cause calling the OnPlayerDeath twice? In my gamemode it seems like it's getting called twice when the player dies in event/minigame.
Using a filterscript and gamemode that hasn't had the callback excluded via checks.
Sew_Sumi is online now   Reply With Quote
Old 12/08/2017, 03:42 PM   #4349
oMa37
Gangsta
 
oMa37's Avatar
 
Join Date: Feb 2016
Posts: 973
Reputation: 136
Default Re: Little coding questions - For general minor queries 5

I don't use filterscripts also I made checks.
oMa37 is offline   Reply With Quote
Old 12/08/2017, 03:54 PM   #4350
Sew_Sumi
High-roller
 
Join Date: Jun 2008
Posts: 4,715
Reputation: 323
Default Re: Little coding questions - For general minor queries 5

You need to post a thread and submit some code... This isn't a minor query.
Sew_Sumi is online now   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to make a soldier aotumaticly be general when the general dies ? AlbanianGuy Scripting Help 35 13/05/2012 03:35 PM
Minor problem Desert Help Archive 4 17/03/2010 06:24 PM
Counting with mysql queries actiwe Help Archive 2 26/02/2010 02:36 PM
SQL queries using GROUP BY Dabombber Help Archive 2 05/10/2009 07:47 PM


All times are GMT. The time now is 12:58 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.