Dear forum users! In compliance with the new European GDPR regulations, we'd just like to inform you that if you have an account, your email address is stored in our database. We do not share your information with third parties, and your email address and password are encrypted for security reasons.
New to the forum? Say hello in this topic! Also make sure to read the rules.
New to the forum? Say hello in this topic! Also make sure to read the rules.
Script for Profile
Forum rules
By using the forum you agree to the following rules.
By using the forum you agree to the following rules.
-
- Meatbag
- Posts: 4
- Joined: Mon Apr 11, 2016 8:16 pm
Script for Profile
Hello, can someone give me a script that can change player profile(looking) when they spawn?
and can i do every player individual profile?
Thanks
-doran
and can i do every player individual profile?
Thanks
-doran
0 x
- JakSparro98
- Superfighter
- Posts: 530
- Joined: Fri Jul 15, 2016 7:56 pm
- Started SFD: PreAlpha 1.0.5
- Location: Rome, Italy
- Gender:
- Age: 25
Put in your map 8 profiles, change each ID from "profile1" to "profile8" then put even a timer trigger with 0 seconds of delay, activate on startup to true and set script method with "ProfileSelector".DoranIsHere wrote:Hello, can someone give me a script that can change player profile(looking) when they spawn?
and can i do every player individual profile?
Thanks
-doran
Here the code:
Code: Select all
String[] IDlist={"profile1","profile2","profile3","profile4","profile5","profile6","profile7","profile8"};
public void ProfileSelector(TriggerArgs arg)
{
int i=0;
IUser check;
IPlayer[] players=Game.GetPlayers();
IObjectPlayerProfileInfo info;
foreach(IPlayer pl in players)
{check=pl.GetUser();
if(check!=null){
info=(IObjectPlayerProfileInfo)Game.GetObjectsByCustomID(IDlist[i])[0];
pl.SetProfile(info.GetProfile());
i++;
}
}
}
1 x
- JakSparro98
- Superfighter
- Posts: 530
- Joined: Fri Jul 15, 2016 7:56 pm
- Started SFD: PreAlpha 1.0.5
- Location: Rome, Italy
- Gender:
- Age: 25
I need to make you see that you haven't specified the string "Policiaa" is a profile name (it is evident but if He don't know anything of programming the script will fail untill He correct that).CrazyDUDE wrote:this is another one (this has to triggered, like when you push the button or somehting else, it will get the profile):
public void GetProfile(TriggerArgs args){
IPlayer ply = (IPlayer)args.Sender;
ply.SetProfile(((IObjectPlayerProfileInfo)
Game.GetFirstObject("Policiaa")).GetProfile());
}
or if it's for all the players...
public void GetProfile(TriggerArgs args){
foreach(IPlayer ply in Game.GetPlayers()){
ply.SetProfile(((IObjectPlayerProfileInfo)
Game.GetFirstObject("Policiaa")).GetProfile());
}
}
REMEMBER: IT HAS TO BE TRIGGERED, OR IF YOU WANT IT'S NOT NECESARY.
Also, as I understood, He needs a profile per player so the maximum number of player in a server (not the bots) is 8 and your script changes only to one profile and even the bot profile.
0 x
- JakSparro98
- Superfighter
- Posts: 530
- Joined: Fri Jul 15, 2016 7:56 pm
- Started SFD: PreAlpha 1.0.5
- Location: Rome, Italy
- Gender:
- Age: 25
CrazyDUDE wrote:well, he can do this:
public void OnStartup(){
foreach(IPlayer ply in Game.GetPlayers()){
ply.SetProfile(((IObjectPlayerProfileInfo)
Game.GetFirstObject("Policiaa")).GetProfile());
}
}
and that's all.
Added in 34 seconds:
"Policiaa" it's just an example of the profile ID
Ok but with this he has only one profile, and he said:
You need to make that each player have an unique profile and not all the same one.DoranIsHere wrote: can i do every player individual profile?
I hope you understood now.
1 x
- JakSparro98
- Superfighter
- Posts: 530
- Joined: Fri Jul 15, 2016 7:56 pm
- Started SFD: PreAlpha 1.0.5
- Location: Rome, Italy
- Gender:
- Age: 25
Well, I'm studying Java programming at school and like c# is an object based programming language, so first of all I need to read the documentation of the API, is a list of methods created by Gurt or standar of the Box2D library and in a little time I was able to write these scripts.CrazyDUDE wrote:well, i didn't but I'll mean that yes.
but also where did you learned this script ?
0 x
-
- Superfighter
- Posts: 67
- Joined: Sun Nov 06, 2016 11:34 pm
- Title: Da God
- SFD Account: Jamisco
- SFD Alias: Jamisco
- Started SFD: either late 2015 or early 2016
- Location: Somewhere in the east of the United states
- Gender:
- Age: 103
Here the code:
[/quote]
hey mr JakSpar, ive been examing some of your code lately inorder to learn and ive noticed you use this fail safe method like you did in this code line
if(check! = null) ... i understand its a fail safe but isn't it completely redundant because the method Game.GetPlayers() will only get players and not something null.. so if i may ask why do you still use it?
Code: Select all
String[] IDlist={"profile1","profile2","profile3","profile4","profile5","profile6","profile7","profile8"};
public void ProfileSelector(TriggerArgs arg)
{
int i=0;
IUser check;
IPlayer[] players=Game.GetPlayers();
IObjectPlayerProfileInfo info;
foreach(IPlayer pl in players)
{check=pl.GetUser();
if(check!=null){
info=(IObjectPlayerProfileInfo)Game.GetObjectsByCustomID(IDlist[i])[0];
pl.SetProfile(info.GetProfile());
i++;
}
}
}
hey mr JakSpar, ive been examing some of your code lately inorder to learn and ive noticed you use this fail safe method like you did in this code line
if(check! = null) ... i understand its a fail safe but isn't it completely redundant because the method Game.GetPlayers() will only get players and not something null.. so if i may ask why do you still use it?
1 x
Is it better to be feared or respected... please, is it too much to ask for both?
- ShutDownMan
- Fighter
- Posts: 32
- Joined: Sat Mar 19, 2016 7:17 pm
- Title: Yeah, science!
- SFD Alias: ShutDownMan, Devil Shut
- Started SFD: 1.2.something
- Location: Hu3, Brazil
- Gender:
- Age: 24
- Contact:
The Game.GetPlayers() will return all players in game, PLAYERS, including bots... Bots don't have an IUser controlling them, so IPlayer.GetUser() can be null, that's why you need a failsafe for thatjamisco wrote: hey mr JakSpar, ive been examing some of your code lately inorder to learn and ive noticed you use this fail safe method like you did in this code line
if(check! = null) ... i understand its a fail safe but isn't it completely redundant because the method Game.GetPlayers() will only get players and not something null.. so if i may ask why do you still use it?
2 x
~ShutDownMan