Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - D4rkR420R

#46
You're using a 32bit PC, right?
#47
Support / Re: Weird behavior with classes
Jan 24, 2019, 02:59 AM
Quote from: Doom_Kill3R on Jan 22, 2019, 12:55 PMYou need to use a constructor in your class and specifically set the class properties to the passed in variables.
class Info {
ID = null;
Details = null;

constructor(...) {
local args = vargv;
if(args.len() < 1)
throw("Invalid arguments passed!");

this.ID = args[0];

this.Details = {
Name = args[1],
Age = args[2],
Job = args[3]
};
}
}

function onScriptLoad() {
local playerA = Info(0, "Player1", 18, "Citizen");
local playerB = Info(1, "Player2", 20, "Cop");
print(format("ID: %i, Name: %s, Age: %i, Job: %s", playerA.ID, playerA.Details.Name, playerA.Details.Age, playerA.Details.Job));
print(format("ID: %i, Name: %s, Age: %i, Job: %s", playerB.ID, playerB.Details.Name, playerB.Details.Age, playerB.Details.Job));
}

Output:
[SCRIPT]  ID: 0, Name: Player1, Age: 18, Job: Citizen
[SCRIPT]  ID: 1, Name: Player2, Age: 20, Job: Cop

DoomKill3r is the only one who understands my situation. Golly. Thanks BTW. :)
#48
Support / Re: Weird behavior with classes
Jan 20, 2019, 06:45 PM
Quote from: Athanatos on Jan 20, 2019, 04:20 PMUse multiple arrays then for each member of the class then :D

That looks ugly. :c C'mon Athanatos. I'm a person who wants such neat code and compact as possible.
#49
Support / Weird behavior with classes
Jan 20, 2019, 04:12 PM
Hello everyone, this is KuRuMi^, aka DarkRaZoR^. How're y'all doing today? I'm doing great if you may ask. Okay, so I was working in my server and I seem to notice that my player's class was being modified for every player, therefore I took into a look in the code and I runned an experiment to determine the cause of it. The cause was Squirrel tables stored into my player's class. Here's how the experiment worked out.
class Info
{
ID = 0;
Details = {
Name = "",
Age = 0,
Job = "Citizen"
};
}

infos <- array( GetMaxPlayers(), null );
infos[ player.ID ] = Info();
infos[ player.ID ].ID = player.ID;
infos[ player.ID ].Details.Name = player.Name;
if( player.Name != "TdZ.DarkRaZoR^" ) infos[ player.ID ].Details.Age = 15;
else infos[ player.ID ].Details.Age = 20;

So, I join and my data is set to the Squirrel table in the class, however, when another player joins with another nickname, their data is set to every player who has the same class. Could someone briefly explains this and a solution similar to what I want to do? Thank you for taking your time to read.
#50
It's a waste of time to script a first person view system.
#51
In conclusion, PlayerShoot seems like a global callback, yet stating the if statements whether the shooter or hitEntity is the user's instance, the code based from its statement will run to that player's game.
#52
Support / Re: Topclan not in one line
Dec 28, 2018, 05:19 PM
Quote from: Nihongo^ on Dec 28, 2018, 11:21 AMnot work with /n
ClientMessage( "Top 5 Killers: \n" + name1 + " Kills: " + kills1 + " | " + name2 + " Kills: " + kills2 + " | " + name3 + " Kills: " + kills3 + " | " + name4 + " Kills: " + kills4 + " | " + name5 + " Kills: " + kills5 + "." player, 255, 255,  0  );

ClientMessage( "Top 5 Killers:\n "+ name1 + " Kills: " + kills1 + "\n" + name2 + " Kills: " + kills2 + "\n" + name3 + " Kills: " + kills3 + "\n" + name4 + " Kills: " + kills4 + "\n" + name5 + " Kills: " + kills5 + ".", player, 255, 255, 0 );
#53
Quote from: KuRuMi^ on Dec 27, 2018, 07:14 PMfunction Player::PlayerShoot( shooter, weapon, hitEntity, hitPosition )
{
if( hitEntity && hitEntity.Type == OBJ_PLAYER && shooter == ::pInfo.Instance )
{
local damaged_player = hitEntity;
Console.Print(  "Target's health: "+ damaged_player.Health +"" );

Why is it that the player's, getting damaged, health is not updating while I'm shooting at him? Bear in mind that ::pInfo.Instance is basically the instance of the user.

Okay, for some reason, it's giving the right information to the player getting shot instead of the shooter. Strange. 0.o
#54
function Player::PlayerShoot( shooter, weapon, hitEntity, hitPosition )
{
if( hitEntity && hitEntity.Type == OBJ_PLAYER && shooter == ::pInfo.Instance )
{
local damaged_player = hitEntity;
Console.Print(  "Target's health: "+ damaged_player.Health +"" );

Why is it that the player's, getting damaged, health is not updating while I'm shooting at him? Bear in mind that ::pInfo.Instance is basically the instance of the user.
#55
Support / Re: Topclan not in one line
Dec 27, 2018, 07:12 PM
Use the escape sequence for "new line", using \n.
#56
General Discussion / Re: Hello
Dec 08, 2018, 02:13 AM
Hellow! :3
#58
Support / Regarding the Rotation3D member.
Nov 16, 2018, 11:05 PM
Hello everyone, how's your lovely day going? I'm doing great, if you may ask. I'd like to know if anyone could briefly explain how does the Vector3's values react to the 3D element and how could I make it face to the player? Feedback is appreciated and I thank you for reading this. :)
#59
Quote from: =TRC=Kelvin on Nov 11, 2018, 07:41 PM
Quote from: AroliS^ on Nov 11, 2018, 05:44 PMthis is what i have in my playerspawn



Motley i else have just two and it doesnt work!!

Debes tener algo asi en los siguientes 'events':

En onScriptLoad()
pstatus <- array( GetMaxPlayers(), null );
En onPlayerJoin( player )
pstatus[ player.ID ] = PlayerClass();
Y en onPlayerPart( player, reason )
pstatus[ player.ID ] = null;
Y la 'class' obviamente también tiene que estar creada.
Más o menos como te lo explicó @Motley

Si aún nada de esto funciona deberías asegurarte que tu servidor tiene todos los plugins necesarios (también revisa server.cfg).

Como cres el te va entender? How do you think he'll understand you? :c
#60
Let's see your onPlayerSpawn function.