Skip to content
This repository was archived by the owner on Jul 18, 2019. It is now read-only.

Commit 515317a

Browse files
author
nrzull
committed
initialize ability to start play on selector play event
1 parent 57c9db3 commit 515317a

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
using System;
2+
using GTANetworkAPI;
3+
using Newtonsoft.Json;
4+
5+
namespace Project.Server.Character.Lobby.Selector
6+
{
7+
public class Events : Script
8+
{
9+
[RemoteEvent(Shared.Events.LOBBY_SELECTOR_PLAY)]
10+
public void OnPlay(Client player, string data)
11+
{
12+
try
13+
{
14+
var payload = JsonConvert.DeserializeObject<Shared.Schemes.LobbySelectorPlay>(data);
15+
16+
var character = Character.Service.GetOwnCharacterByFullName(player, payload.FirstName, payload.LastName);
17+
18+
if (character is Character.Entity)
19+
{
20+
Service.Play(player, character);
21+
}
22+
}
23+
catch (Exception e)
24+
{
25+
Console.WriteLine(e);
26+
}
27+
}
28+
}
29+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using System;
2+
using GTANetworkAPI;
3+
4+
namespace Project.Server.Character.Lobby.Selector
5+
{
6+
public static class Service
7+
{
8+
public static void Play(Client player, Character.Entity character)
9+
{
10+
var attachment = new Character.Attachment
11+
{
12+
Entity = character
13+
};
14+
15+
Character.Service.SetAttachment(player, attachment);
16+
17+
// TODO continue logic
18+
Console.WriteLine("Selector Service Play: im here");
19+
}
20+
}
21+
}

0 commit comments

Comments
 (0)