Changeset 573 for Daodan/MSVC/Flatline_BSL.c
- Timestamp:
- Sep 9, 2010, 11:27:04 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Daodan/MSVC/Flatline_BSL.c
r569 r573 41 41 NetUDPSocket_Send(client_sock, (sockaddr*)&address, (char*)&packet, 257); 42 42 } 43 if(server_started) 44 { 45 sprintf_s(PlayerList[0]->Chr->Name,32, args[0].value_str32); 46 } 43 47 return 0; 44 48 } … … 118 122 { 119 123 player_info * info; 120 info = FLrServer_AddPlayer( 0, "Fake", 0 ); 121 info->Actions1 = Action_Forward; 122 return 0; 124 info = FLrServer_AddPlayer( 0, "shinny", 0 , 1); 125 return 0; 126 } 127 128 uint16_t ONICALL kick(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret) 129 { 130 PlayerDisconnect(args[0].value_int32); 131 return 0; 132 } 133 134 CharacterObject* spawnObject = 0; 135 char BINACHARCallback(CharacterObject* inObj, char* userdata) 136 { 137 if(strcmp(userdata, inObj->OSD.Name)) 138 { 139 return 1; 140 } 141 spawnObject = inObj; 142 return 0; 143 } 144 uint16_t ONICALL FLrSpawnHack(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret) 145 { 146 flatline_packet new_char = {0}; 147 int i; 148 if(client_connected) return 0; 149 AI2iScript_Spawn(callinfo, numargs, args, dontuse1, dontuse2, ret); 150 if(!server_started) return 0; 151 for(i = 0; i < 64; i++) 152 { 153 if(!strcmp(ONgGameState->CharacterStorage[i].Name, args[0].value_str32)) 154 { 155 //DDrConsole_PrintF("%s spawned, slot %i", args[0].value_str32, i); 156 int playerlist_slot = FLr_FindEmptyListSlot(); 157 int player_slot = i; 158 new_char.new_player.Playernumber = playerlist_slot; 159 new_char.id = NEW_PLAYER; 160 OBJrObjectType_EnumerateObjects('CHAR',BINACHARCallback, (int)args[0].value_str32); 161 // while(!spawnObject); 162 if(spawnObject) 163 { 164 memcpy(&new_char.new_player.Character, spawnObject, sizeof(CharacterObject) ); 165 } 166 else return 1; 167 //new_char.new_player.Character; 168 PlayerList[playerlist_slot] = Players+player_slot; 169 PlayerList[playerlist_slot]->spawnnumber = player_slot; 170 PlayerList[playerlist_slot]->Chr = &((Character *)(((GameState * )(ONgGameState))->CharacterStorage))[player_slot]; 171 // PlayerList[playerlist_slot]->Chr->Flags = chr_dontaim | chr_unkillable; //&= 0xFFBFFFFF; //WTF 172 // if(!is_bot) PlayerList[playerlist_slot]->Chr->Flags &= 0xFFBFFFFF; //WTF 173 // sprintf(PlayerList[playerlist_slot]->Chr->Name, "%.31s", name); 174 UDPServer_SendToAll( (char*)&new_char, sizeof(new_player) + FLATLINE_HEADER ); 175 PlayerList[playerlist_slot]->flags = PF_SCRIPTEDAI; 176 PlayerList[playerlist_slot]->list_slot = playerlist_slot; 177 return 0; 178 } 179 } 180 181 return 0; 123 182 } 124 183 … … 140 199 141 200 DDrPatch_MakeCall(0x004FA88B, FLrInput_Update_Keys); 142 201 FLrInput_Update_Keys(); 143 202 SLrGlobalVariable_Register_Int32("skip", "skips", &(((GameState*)ONgGameState)->field_40) ); 144 203 SLrScript_Command_Register_ReturnType("connect","Connects to a server", "ip:string", sl_void, connect_to_server); 145 204 SLrScript_Command_Register_Void("host","Starts a server", "", start_server); 146 205 SLrScript_Command_Register_Void("msg","Sends a message", "", send_message); 147 SLrScript_Command_Register_ReturnType("name","changes your name", "name:str ", sl_void, change_name);206 SLrScript_Command_Register_ReturnType("name","changes your name", "name:string", sl_void, change_name); 148 207 SLrScript_Command_Register_Void("status","shows the connection status", "", status); 149 208 SLrGlobalVariable_Register_String("country", "Your Multiplayer country", player_name); 150 SLrScript_Command_Register_ReturnType("addfakeclient","adds a fake client", "", sl_void, addfake); 151 } 209 SLrScript_Command_Register_ReturnType("addbot","adds a fake client", "", sl_void, addfake); 210 SLrScript_Command_Register_Void("kick", "Kicks a client from the server", "clientnum:int", kick); 211 //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); 212 }
Note:
See TracChangeset
for help on using the changeset viewer.