equal
deleted
inserted
replaced
182 LuaError('Lua: Wrong number of parameters passed to WriteLnToConsole!'); |
182 LuaError('Lua: Wrong number of parameters passed to WriteLnToConsole!'); |
183 lc_writelntoconsole:= 0; |
183 lc_writelntoconsole:= 0; |
184 end; |
184 end; |
185 |
185 |
186 function lc_parsecommand(L : Plua_State) : LongInt; Cdecl; |
186 function lc_parsecommand(L : Plua_State) : LongInt; Cdecl; |
|
187 var t: PChar; |
|
188 i,c: LongWord; |
|
189 s: shortstring; |
187 begin |
190 begin |
188 if lua_gettop(L) = 1 then |
191 if lua_gettop(L) = 1 then |
189 begin |
192 begin |
190 ParseCommand(lua_tostring(L ,1), true); |
193 t:= lua_tolstring(L,1,@c); |
|
194 |
|
195 for i:= 1 to c do s[i]:= t[i-1]; |
|
196 s[0]:= char(c); |
|
197 |
|
198 ParseCommand(s, true); |
|
199 |
191 end |
200 end |
192 else |
201 else |
193 LuaError('Lua: Wrong number of parameters passed to ParseCommand!'); |
202 LuaError('Lua: Wrong number of parameters passed to ParseCommand!'); |
194 lc_parsecommand:= 0; |
203 lc_parsecommand:= 0; |
195 end; |
204 end; |
311 begin |
320 begin |
312 if lua_gettop(L) = 3 then |
321 if lua_gettop(L) = 3 then |
313 health:= lua_tointeger(L, 3) |
322 health:= lua_tointeger(L, 3) |
314 else |
323 else |
315 health:= cHealthCaseAmount; |
324 health:= cHealthCaseAmount; |
316 gear := SpawnCustomCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2), HealthCrate, health); |
325 gear := SpawnCustomCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2), HealthCrate, health, 0); |
317 if gear <> nil then |
326 if gear <> nil then |
318 lua_pushinteger(L, gear^.uid) |
327 lua_pushinteger(L, gear^.uid) |
319 else |
328 else |
320 lua_pushnil(L); |
329 lua_pushnil(L); |
321 end; |
330 end; |
323 end; |
332 end; |
324 |
333 |
325 function lc_spawnammocrate(L: PLua_State): LongInt; Cdecl; |
334 function lc_spawnammocrate(L: PLua_State): LongInt; Cdecl; |
326 var gear: PGear; |
335 var gear: PGear; |
327 begin |
336 begin |
328 if lua_gettop(L) <> 3 then |
337 if (lua_gettop(L) <> 3) and (lua_gettop(L) <> 4) then |
329 begin |
338 begin |
330 LuaError('Lua: Wrong number of parameters passed to SpawnAmmoCrate!'); |
339 LuaError('Lua: Wrong number of parameters passed to SpawnAmmoCrate!'); |
331 lua_pushnil(L); |
340 lua_pushnil(L); |
332 end |
341 end |
333 else |
342 else |
334 begin |
343 begin |
335 gear := SpawnCustomCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2), AmmoCrate, lua_tointeger(L, 3)); |
344 if (lua_gettop(L) = 3) then |
|
345 gear := SpawnCustomCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2), AmmoCrate, lua_tointeger(L, 3), 0) |
|
346 else gear := SpawnCustomCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2), AmmoCrate, lua_tointeger(L, 3), lua_tointeger(L, 4)); |
336 if gear <> nil then |
347 if gear <> nil then |
337 lua_pushinteger(L, gear^.uid) |
348 lua_pushinteger(L, gear^.uid) |
338 else |
349 else |
339 lua_pushnil(L); |
350 lua_pushnil(L); |
340 end; |
351 end; |
342 end; |
353 end; |
343 |
354 |
344 function lc_spawnutilitycrate(L: PLua_State): LongInt; Cdecl; |
355 function lc_spawnutilitycrate(L: PLua_State): LongInt; Cdecl; |
345 var gear: PGear; |
356 var gear: PGear; |
346 begin |
357 begin |
347 if lua_gettop(L) <> 3 then |
358 if (lua_gettop(L) <> 3) and (lua_gettop(L) <> 4) then |
348 begin |
359 begin |
349 LuaError('Lua: Wrong number of parameters passed to SpawnUtilityCrate!'); |
360 LuaError('Lua: Wrong number of parameters passed to SpawnUtilityCrate!'); |
350 lua_pushnil(L); |
361 lua_pushnil(L); |
351 end |
362 end |
352 else |
363 else |
353 begin |
364 begin |
354 gear := SpawnCustomCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2), |
365 if (lua_gettop(L) = 3) then |
355 UtilityCrate, lua_tointeger(L, 3)); |
366 gear := SpawnCustomCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2), UtilityCrate, lua_tointeger(L, 3), 0) |
|
367 else gear := SpawnCustomCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2), UtilityCrate, lua_tointeger(L, 3), lua_tointeger(L, 4)); |
356 if gear <> nil then |
368 if gear <> nil then |
357 lua_pushinteger(L, gear^.uid) |
369 lua_pushinteger(L, gear^.uid) |
358 else |
370 else |
359 lua_pushnil(L); |
371 lua_pushnil(L); |
360 end; |
372 end; |