| 31 |
|
|
| 32 |
|
uint16_t ONICALL change_name(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret) |
| 33 |
|
{ |
| 34 |
< |
|
| 34 |
> |
|
| 35 |
|
//should also return your name... |
| 36 |
|
sprintf(player_name, "%.31s", args[0].value_str32); |
| 37 |
|
if(client_connected) { |
| 72 |
|
uint16_t ONICALL connect_to_server(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret) |
| 73 |
|
{ |
| 74 |
|
if( NetPlatform_Initalize()) { |
| 75 |
< |
static flatline_packet packet; |
| 76 |
< |
sock = NetUDPSocket_Create(27777); |
| 77 |
< |
address.sin_family = AF_INET; address.sin_port = htons(27777); address.sin_addr.S_un.S_addr = inet_addr(args[0].value_str32 ); |
| 78 |
< |
//address.sin_family = AF_INET; address.sin_port = htons(27777); address.sin_addr.S_un.S_addr = inet_addr("192.168.0.1"); |
| 79 |
< |
|
| 80 |
< |
packet.id = CONNECT_SEND; |
| 81 |
< |
memcpy(((connect_send*)(packet.data))->country , player_country, 2); |
| 82 |
< |
memcpy(((connect_send*)(packet.data))->name, player_name, 256); |
| 83 |
< |
DDrConsole_PrintF("%s", ((connect_send*)(packet.data))->name); |
| 84 |
< |
CreateThread(NULL, 0, StartClient, &packet, 0, 0); |
| 75 |
> |
static flatline_packet packet; |
| 76 |
> |
sock = NetUDPSocket_Create(27777); |
| 77 |
> |
address.sin_family = AF_INET; address.sin_port = htons(27777); address.sin_addr.S_un.S_addr = inet_addr(args[0].value_str32 ); |
| 78 |
> |
//address.sin_family = AF_INET; address.sin_port = htons(27777); address.sin_addr.S_un.S_addr = inet_addr("192.168.0.1"); |
| 79 |
> |
|
| 80 |
> |
packet.id = CONNECT_SEND; |
| 81 |
> |
memcpy(((connect_send*)(packet.data))->country , player_country, 2); |
| 82 |
> |
memcpy(((connect_send*)(packet.data))->name, player_name, 256); |
| 83 |
> |
DDrConsole_PrintF("%s", ((connect_send*)(packet.data))->name); |
| 84 |
> |
CreateThread(NULL, 0, StartClient, &packet, 0, 0); |
| 85 |
|
|
| 86 |
|
} |
| 87 |
|
|
| 110 |
|
j, |
| 111 |
|
PlayerList[j]->name, |
| 112 |
|
PlayerList[j]->Chr |
| 113 |
< |
); |
| 113 |
> |
); |
| 114 |
|
} |
| 115 |
|
} |
| 116 |
|
} |
| 132 |
|
return 0; |
| 133 |
|
} |
| 134 |
|
|
| 135 |
+ |
uint16_t ONICALL ping(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret) |
| 136 |
+ |
{ |
| 137 |
+ |
if(server_started) |
| 138 |
+ |
{ |
| 139 |
+ |
FLsPingAll(); |
| 140 |
+ |
} |
| 141 |
+ |
return 0; |
| 142 |
+ |
} |
| 143 |
+ |
|
| 144 |
|
CharacterObject* spawnObject = 0; |
| 145 |
|
char BINACHARCallback(CharacterObject* inObj, char* userdata) |
| 146 |
|
{ |
| 168 |
|
new_char.new_player.Playernumber = playerlist_slot; |
| 169 |
|
new_char.id = NEW_PLAYER; |
| 170 |
|
OBJrObjectType_EnumerateObjects('CHAR',BINACHARCallback, (int)args[0].value_str32); |
| 171 |
< |
// while(!spawnObject); |
| 171 |
> |
// while(!spawnObject); |
| 172 |
|
if(spawnObject) |
| 173 |
|
{ |
| 174 |
|
memcpy(&new_char.new_player.Character, spawnObject, sizeof(CharacterObject) ); |
| 187 |
|
return 0; |
| 188 |
|
} |
| 189 |
|
} |
| 190 |
< |
|
| 191 |
< |
return 0; |
| 190 |
> |
|
| 191 |
> |
return 0; |
| 192 |
|
} |
| 193 |
|
|
| 194 |
|
uint16_t ONICALL list_players(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret) |
| 201 |
|
DDrConsole_PrintF("%i %i | %s", i, PlayerList[i]->spawnnumber, PlayerList[i]->name); |
| 202 |
|
} |
| 203 |
|
} |
| 204 |
< |
return 0; |
| 204 |
> |
return 0; |
| 205 |
|
} |
| 206 |
|
uint16_t ONICALL con(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret) |
| 207 |
|
{ |
| 209 |
|
return 0; |
| 210 |
|
} |
| 211 |
|
|
| 212 |
< |
|
| 213 |
< |
void SLrFlatline_Initialize() { |
| 214 |
< |
|
| 212 |
> |
|
| 213 |
> |
void SLrFlatline_Initialize() |
| 214 |
> |
{ |
| 215 |
> |
|
| 216 |
|
DDrPatch_MakeCall(0x004FA88B, FLrInput_Update_Keys); |
| 217 |
|
FLrInput_Update_Keys(); |
| 218 |
|
SLrGlobalVariable_Register_Int32("skip", "skips", &(((GameState*)ONgGameState)->field_40) ); |
| 226 |
|
SLrScript_Command_Register_Void("kick", "Kicks a client from the server", "clientnum:int", kick); |
| 227 |
|
SLrScript_Command_Register_Void("con", "Activates a console", "con:int", con); |
| 228 |
|
//SLrScript_Command_Register_ReturnType("ai2_spawn","creates and starts an AI from a character object","ai_name:string [force_spawn:string{\"force\"} | ]", sl_void, spawnAI); |
| 229 |
+ |
SLrScript_Command_Register_Void("ping", "pong!", "", ping); |
| 230 |
|
} |