2187 lc_setsoundmask:= 0; |
2187 lc_setsoundmask:= 0; |
2188 end; |
2188 end; |
2189 |
2189 |
2190 function lc_addteam(L : Plua_State) : LongInt; Cdecl; |
2190 function lc_addteam(L : Plua_State) : LongInt; Cdecl; |
2191 var np: LongInt; |
2191 var np: LongInt; |
|
2192 colorArg: Int64; |
|
2193 colorStr: shortstring; |
2192 begin |
2194 begin |
2193 if CheckAndFetchParamCount(L, 5, 6, 'AddTeam', 'teamname, color, grave, fort, voicepack [, flag]', np) then |
2195 if CheckAndFetchParamCount(L, 5, 6, 'AddTeam', 'teamname, color, grave, fort, voicepack [, flag]', np) then |
2194 begin |
2196 begin |
2195 ParseCommand('addteam x ' + lua_tostring(L, 2) + ' ' + lua_tostring(L, 1), true, true); |
2197 colorArg:= Trunc(lua_tonumber(L, 2)); |
|
2198 if (colorArg < 0) and (abs(colorArg) <= cClanColors) then |
|
2199 // Pick clan color from settings (recommended) |
|
2200 colorStr:= IntToStr(ClanColorArray[Pred(abs(colorArg))]) |
|
2201 else if (colorArg >= 0) and (colorArg <= $ffffffff) then |
|
2202 // Specify color directly |
|
2203 colorStr:= IntToStr(colorArg) |
|
2204 else |
|
2205 begin |
|
2206 OutError('Lua error: AddTeam: Invalid ''color'' argument, must be between '+IntToStr(-cClanColors)+' and 0xffffffff!', true); |
|
2207 lc_addteam:= 0; |
|
2208 exit; |
|
2209 end; |
|
2210 ParseCommand('addteam x ' + colorStr + ' ' + lua_tostring(L, 1), true, true); |
2196 ParseCommand('grave ' + lua_tostring(L, 3), true, true); |
2211 ParseCommand('grave ' + lua_tostring(L, 3), true, true); |
2197 ParseCommand('fort ' + lua_tostring(L, 4), true, true); |
2212 ParseCommand('fort ' + lua_tostring(L, 4), true, true); |
2198 ParseCommand('voicepack ' + lua_tostring(L, 5), true, true); |
2213 ParseCommand('voicepack ' + lua_tostring(L, 5), true, true); |
2199 if (np = 6) then ParseCommand('flag ' + lua_tostring(L, 6), true, true); |
2214 if (np = 6) then ParseCommand('flag ' + lua_tostring(L, 6), true, true); |
2200 CurrentTeam^.Binds:= DefaultBinds |
2215 CurrentTeam^.Binds:= DefaultBinds |