Page 1 of 2
Sniper only?
Posted: Wed Mar 22, 2006 6:53 pm
by Barttje
Hi all,
I'm trying to make a sniper-only game but I want it in a code
this is what I have but it doesn't work
Code: Select all
sniper_only:
if ($player.dmteam == "axis")
{
$player takeall
$player item weapons/kar98sniper.tik
}
if ($player.dmteam == "allies")
{
$player takeall
$player item weapons/springfield.tik
}
wait 0.1
goto Sniper_only
end
Re: Sniper only?
Posted: Wed Mar 22, 2006 7:38 pm
by Habsey
Code: Select all
sniper_only:
while(1)
{
for(local.i=1;local.i <= $player.size;local.i++)
{
if ($player.dmteam == "axis")
{
$player takeall
$player item weapons/kar98sniper.tik
}
else if ($player.dmteam == "allies")
{
$player takeall
$player item weapons/springfield.tik
}
}
waitframe
}
end
should do the trick
Posted: Wed Mar 22, 2006 8:04 pm
by Barttje
tnx it work, but only he is taking he's waepon again and again now i got no chance to shoot
how can I stop it?
Re: Sniper only?
Posted: Wed Mar 22, 2006 8:13 pm
by Habsey
Code: Select all
sniper_only:
while(1)
{
for(local.i=1;local.i <= $player.size;local.i++)
{
if(local.take != 1)
{
if ($player.dmteam == "axis")
{
$player takeall
$player item weapons/kar98sniper.tik
local.take = 1
}
else if ($player.dmteam == "allies")
{
$player takeall
$player item weapons/springfield.tik
local.take = 1
}
}
else
{
if((!(isalive $player)) || local.player.dmteam != local.t)
{
local.take = 0
}
}
}
waitframe
}
end
this should work good lol
Posted: Wed Mar 22, 2006 8:13 pm
by Green Beret
Heres code from another post, I think the part of the code i think you need is the
if(isAlive local.player) {
if(local.player.model == "some/scpecific/model.tik") {
//code to swap weapons
}
Code: Select all
while (1) {
for(local.i = 1; local.i <= $player.size; local.i++) {
local.player = $player[local.i]
if(isAlive local.player) {
if(local.player.model == "some/scpecific/model.tik") {
//code to swap weapons
}
}
waitframe
}
wait 1
}
end
Re: Sniper only?
Posted: Wed Mar 22, 2006 8:22 pm
by Barttje
Habsey wrote:Code: Select all
sniper_only:
while(1)
{
for(local.i=1;local.i <= $player.size;local.i++)
{
if(local.take != 1)
{
if ($player.dmteam == "axis")
{
$player takeall
$player item weapons/kar98sniper.tik
local.take = 1
}
else if ($player.dmteam == "allies")
{
$player takeall
$player item weapons/springfield.tik
local.take = 1
}
}
else
{
if((!(isalive $player)) || local.player.dmteam != local.t)
{
local.take = 0
}
}
}
waitframe
}
end
this should work good lol
Now the whole sniper-only script doesn't work :S
Green Beret wrote:Heres code from another post, I think the part of the code i think you need is the...
I don't get it...
Re: Sniper only?
Posted: Wed Mar 22, 2006 8:38 pm
by Habsey
oops wont let me delete this post :S
Re: Sniper only?
Posted: Wed Mar 22, 2006 8:38 pm
by Habsey
WOOPS! i missed a few thing :S sorry try this out
Code: Select all
sniper_only:
local.t = $player.dmteam
while(1)
{
for(local.i=1;local.i <= $player.size;local.i++)
{
if(local.take != 1)
{
if ($player[local.i].dmteam == "axis")
{
$player[local.i] takeall
$player[local.i] item weapons/kar98sniper.tik
local.take = 1
}
else if ($player[local.i].dmteam == "allies")
{
$player[local.i] takeall
$player[local.i] item weapons/springfield.tik
local.take = 1
}
}
if((!(isalive $player[local.i])) || local.player[local.i].dmteam != local.t)
{
local.take = 0
}
}
waitframe
}
end
Posted: Wed Mar 22, 2006 8:46 pm
by Barttje
still doesn't work :S
Posted: Wed Mar 22, 2006 10:59 pm
by Elgan
Bartjerambo wrote:still doesn't work :S
You could try adminpro's weapons limiter. just put a 0 next to all weapons except snipers.
and habsey,,,,local. is valid across the thread. look at ur script and u will see it is impossible , maybe for one player.
Posted: Thu Mar 23, 2006 7:06 am
by Barttje
yeah but thats for every map, i want it for only one map...
Here is a *.scr file script what I have
Code: Select all
main:
thread Set_mapssettings
Set_mapssettings:
local.mapname = getcvar(mapname)
switch local.mapname
{
case "dm/mohdm1":
thread Sniper_only
break
case "dm/mohdm2":
break
case "dm/mohdm3":
break
case "dm/mohdm4":
break
case "dm/mohdm5":
break
case "dm/mohdm6":
break
case "dm/mohdm7":
break
//obj
case "obj/obj_team1":
break
case "obj/obj_team2":
thread Give-all
break
case "obj/obj_team3":
break
case "obj/obj_team4":
break
//Sp-MP Maps
case "m5l1b":
break
case "m1l3b":
break
case "m1l3a":
break
}
end
Give-all:
$player item weapons/colt45.tik
$player item weapons/p38.tik
$player item weapons/silencedpistol.tik
$player item weapons/m1_garand.tik
$player item weapons/kar98.tik
$player item weapons/kar98sniper.tik
$player item weapons/springfield.tik
$player item weapons/thompsonsmg.tik
$player item weapons/mp40.tik
$player item weapons/mp44.tik
$player item weapons/bar.tik
$player item weapons/bazooka.tik
$player item weapons/panzerschreck.tik
$player item weapons/shotgun.tik
$player item weapons/m2frag_grenade.tik
$player item weapons/steilhandgranate.tik
wait .1
goto Give-all
end
sniper_only:
while(1)
{
for(local.i=1;local.i <= $player.size;local.i++)
{
if(local.take != 1)
{
if ($player[local.i].dmteam == "axis")
{
$player[local.i] takeall
$player[local.i] item weapons/kar98sniper.tik
local.take = 1
}
else if ($player[local.i].dmteam == "allies")
{
$player[local.i] takeall
$player[local.i] item weapons/springfield.tik
local.take = 1
}
}
if((!(isalive $player[local.i])) || local.player[local.i].dmteam != local.t)
{
local.take = 0
}
}
waitframe
}
end
I don't know whats wrong... :S
Posted: Thu Mar 23, 2006 10:21 am
by Elgan
adminpro has map sepcific options., in mods.txt next to weapons-limiter put "1" on the far right coloum "map specific" then create a new weapons-limiter.txt for your map and your sorted.
Posted: Thu Mar 23, 2006 12:56 pm
by Barttje
i don't got adminpro, i don't even have a server

but i'm gonna create one...
but is it not easyer in a script like my post up here?
Posted: Thu Mar 23, 2006 1:50 pm
by Elgan
Bartjerambo wrote:i don't got adminpro, i don't even have a server

but i'm gonna create one...
but is it not easyer in a script like my post up here?
not if u want it done properly. thats why i suggested AP. If u wanna make a script then go ahead. i wud suggest using spawn detect script and checking weapon, rather then taking away and giving weapons every so often.
or, you could take every weapon cept the 2 sniper rifles...
Posted: Thu Mar 23, 2006 6:17 pm
by Barttje
Elgan wrote:not if u want it done properly. thats why i suggested AP. If u wanna make a script then go ahead. i wud suggest using spawn detect script and checking weapon, rather then taking away and giving weapons every so often.
or, you could take every weapon cept the 2 sniper rifles...
and i'm asking for help, because i a'm a noob in scripting
so does someone knows a script that's working

plz tell me all the script up here ive triet but nothing seem to work, plz help me