Ford Posted April 12, 2009 Share Posted April 12, 2009 Hello, I want to make script for team playing (two teams, red and blue) so it would count team and player stats on the end of each map. alias bluepoints !return $readini(prsmix.ini,points,blue) alias redpoints !return $readini(prsmix.ini,points,red) on *:SIGNAL:mta.command: { elseif ($3 == !addmered) { var %p = $mta.nick($1,$2) if ($readini(prsmix.ini,red,%p) == yes) mta.text $1 %p $+ : youre already in Red Team. else { mta.text $1 %p added to Red Team writeini prsmix.ini red %p yes writeini prsmix.ini blue %p no } } elseif ($3 == !addmeblue) { var %p = $mta.nick($1,$2) if ($readini(prsmix.ini,blue,%p) == yes) mta.text $1 %p $+ : youre already in Blue Team. else { mta.text $1 %p added to Blue Team writeini prsmix.ini blue %p yes writeini prsmix.ini red %p no } } elseif ($3 == !resetmix) { mta.text $1 Wszystkie zapisane informacje nt. biezacego mixa usuniete. remini prsmix.ini blue remini prsmix.ini red writeini prsmix.ini points blue 0 writeini prsmix.ini points red 0 } elseif ($3 == !mixpoints) { .timermix1 1 1 mta.text $1 Staty $+ : .timermix2 1 1 mta.text $1 Blue Team $+ : $bluepoints($1) punktow .timermix3 1 1 mta.text $1 Red Team $+ : $redpoints($1) punktow } elseif ($3 == !endmix) { if ($bluepoints($1) > $redpoints($1)) mta.text $1 Blue Team wygrywa przewaga $calc($bluepoints($1) - $redpoints($1)) punktow elseif ($redpoints($1) > $bluepoints($1)) mta.text $1 Red Team wygrywa przewaga $calc($redpoints($1) - $bluepoints($1)) punktow elseif ($bluepoints($1) == $redpoints($1)) mta.text $1 Remis! Oba Teamy maja tyle samo punktow! } } on *:SIGNAL:mta.finish: { var %p = $mta.nick($1,$2) if ($mta.rank($1,$2) == 1) { if ($readini(prsmix.ini,blue,%p) == yes) { mta.text $1 Blue Team zdobywa 3 punkty! writeini prsmix.ini points blue $calc($bluepoints($1) + 3) } elseif ($readini(prsmix.ini,red,%p) == yes) { mta.text $1 Red Team zdobywa 3 punkty! writeini prsmix.ini points red $calc($redpoints($1) + 3) } } if ($mta.rank($1,$2) == 2) { if ($readini(prsmix.ini,blue,%p) == yes) { mta.text $1 Blue Team zdobywa 2 punkty! writeini prsmix.ini points blue $calc($bluepoints($1) + 2) } elseif ($readini(prsmix.ini,red,%p) == yes) { mta.text $1 Red Team zdobywa 2 punkty! writeini prsmix.ini points red $calc($redpoints($1) + 2) } } if ($mta.rank($1,$2) == 3) { if ($readini(prsmix.ini,blue,%p) == yes) { mta.text $1 Blue Team zdobywa 1 punkt! writeini prsmix.ini points blue $calc($bluepoints($1) + 1) } elseif ($readini(prsmix.ini,red,%p) == yes) { mta.text $1 Red Team zdobywa 1 punkt! writeini prsmix.ini points red $calc($redpoints($1) + 1) } } (so far it works great and sryy for only partial translation but Im in a bit hurry) and now I need general info regarding: saving 1st, 2nd and 3rd places into ini file (so i could use $calc to calculate each team's score) counting how many players is in each team (I wanted to make it with if but it's just too many possibilities like player leaves etc. so maybe theres simpler way). and most important: !redsquad and !bluesquad must show who is in each team Is there a FAQ with commands available and their descriptions? Thanks Link to comment
[UVA]Bart Posted April 16, 2009 Share Posted April 16, 2009 save it all to a ini file ??? like 2 ini's 1 called teamdetails.ini [red] 1st = blah 2nd = blah 3rd = blah Players = ammount [blue] 1st = blah 2nd = blah 3rd = blah Players = ammount and then call the other one teamplayers.ini [redplayers] 1 = bob 2 = jim 3 = sam 4 = player 4 [blueplayers] 1 = bob 2 = jim 3 = sam 4 = player 4 then simply loop through all the numbers under the blue set of players and the red set of players to return all the players in that team Link to comment
Ford Posted April 18, 2009 Author Share Posted April 18, 2009 Yes but if someone leaves the game or changes team I think it won't work unless theres a way to remove the number=nick value from ini file but then there will be gap between numbers eg. 1=nick1 2=nick2 4=nick4 I don't know how does loop work so i'm not sure. Could you give me an example of how does loop work and how to remove number=nick if someone leaves/changes team? Link to comment
[UVA]Bart Posted April 19, 2009 Share Posted April 19, 2009 there is a way to update a ini, you have to loop through the ini and as you loop you will write it again, but when you find the player thats quiting or changing team, then when you have tell the loop to ignore him and continue something like if ( the var used for the loop == the player thats quitting ) then you need to add 1 to your var and dont let it copy the name to the new ini lol think this is the complicated way scooby will know a easier one haha Link to comment
GeForce Posted April 20, 2009 Share Posted April 20, 2009 (edited) Edited October 11, 2009 by Guest Link to comment
[UVA]Bart Posted April 21, 2009 Share Posted April 21, 2009 the first error i see is that your missing is the alias for gusms.getid Link to comment
Recommended Posts