SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 13/02/2018, 12:44 PM   #21
Mugala
Gangsta
 
Mugala's Avatar
 
Join Date: Nov 2012
Location: behind u
Posts: 530
Reputation: 23
Default Re: A little question

Quote:
Originally Posted by Sew_Sumi View Post
The code is also inherently bugged though... It will appear to be working 'fine', but it's not done right. It's to do with the array, and how it's being used. 1 v 1, 3, or 4 people you won't notice a problem.
it's not a global variable, object is created for all of the persons who took damage.
__________________
here to help
Mugala is offline   Reply With Quote
Old 13/02/2018, 02:22 PM   #22
Sew_Sumi
Godfather
 
Join Date: Jun 2008
Posts: 5,582
Reputation: 446
Default Re: A little question

Quote:
Originally Posted by Mugala View Post
it's not a global variable, object is created for all of the persons who took damage.
That's where there's a problem in this... You have 10 players for instance, and in the odd chance that they all take damage, that's 100 objects being created.

This is just to show an example, the actual issue would come from it being ongoing.

In the video that showed the hearts spamming, that would be, in the same scenario, 400+ objects.
Sew_Sumi is offline   Reply With Quote
Old 13/02/2018, 03:19 PM   #23
Mugala
Gangsta
 
Mugala's Avatar
 
Join Date: Nov 2012
Location: behind u
Posts: 530
Reputation: 23
Default Re: A little question

Quote:
Originally Posted by Sew_Sumi View Post
That's where there's a problem in this... You have 10 players for instance, and in the odd chance that they all take damage, that's 100 objects being created.

This is just to show an example, the actual issue would come from it being ongoing.

In the video that showed the hearts spamming, that would be, in the same scenario, 400+ objects.
yeah I already told him that he can use global variables to avoid spamming for creating objects.
__________________
here to help
Mugala is offline   Reply With Quote
Old 13/02/2018, 05:01 PM   #24
ivndosos
Huge Clucker
 
ivndosos's Avatar
 
Join Date: Sep 2014
Location: Russian Federation, Kaliningrad.
Posts: 294
Reputation: 15
Default Re: A little question

This one works perfectly but can I disable that the player who got hit won't see it? because It's distracting!

Code:
		new Float:X,Float:Y,Float:Z;
		GetPlayerPos(playerid,X,Y,Z);
		new obj = CreateObject(1240,X,Y,Z+1.5,0,0,0);
		AttachObjectToPlayer(obj,playerid,0,0,2.0,0,0,0);
		SetTimerEx("DestroyThisAttachedObject",4000,0,"i",obj);
		return 1;
}

forward DestroyThisAttachedObject(obj);
public DestroyThisAttachedObject(obj)
{
    DestroyObject(obj);
    return 1;
}
ivndosos is offline   Reply With Quote
Old 13/02/2018, 05:46 PM   #25
Mugala
Gangsta
 
Mugala's Avatar
 
Join Date: Nov 2012
Location: behind u
Posts: 530
Reputation: 23
Default Re: A little question

Quote:
Originally Posted by ivndosos View Post
This one works perfectly but can I disable that the player who got hit won't see it? because It's distracting!
no you can't disable for this player, otherwise you can't attach the object.
__________________
here to help
Mugala is offline   Reply With Quote
Old 13/02/2018, 06:14 PM   #26
ivndosos
Huge Clucker
 
ivndosos's Avatar
 
Join Date: Sep 2014
Location: Russian Federation, Kaliningrad.
Posts: 294
Reputation: 15
Default Re: A little question

alright, thanks anyway you helped me alot!
ivndosos is offline   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
[QUESTION] Kind a team based question Dirkon Scripting Help 1 24/03/2013 09:05 PM
Question regarding playerid (noob question!) Mattjones17 Help Archive 5 27/10/2010 05:21 PM
Data type question.. (and mac address question) DarrenReeder Help Archive 2 21/10/2010 09:20 PM
Hello all i got one question (very easy to answer J.I.C question) SAMPfan109 General 0 06/03/2010 05:43 PM


All times are GMT. The time now is 01:17 AM.


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