Event! - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Event! (
/showthread.php?tid=151085)
Event! -
ColdXX - 29.05.2010
Hey guys!
Ive made a Timer which teleports every player on the server at a DM area!
It supose to give the winner some money and some points
How do i 'find' who the winner is??
Thanks in advance
Re: Event! -
(SF)Noobanatior - 29.05.2010
pawn Код:
//assign a var to every one in the round ie
bool:dmplayers[MAX_PLAYERS]
//when they join
dmplayer[playerid] = true;
//when they die
dmplayer[playerid] = false;
//and each time a player dies when the dm is running check how many are left
new test;
for(new i=0;i<MAX_PLAYERS;i++) {
if(dmplayer[i] == true) test++
}
if(test == 1){
//found the winner end dm and announce and award etc
}
Re: Event! -
ColdXX - 29.05.2010
This might sound stupid but IDC
Could u explain better? please
Re: Event! -
(SF)Noobanatior - 29.05.2010
Quote:
Originally Posted by (SF)Noobanatior
pawn Код:
//assign a var to every one in the round ie (top of script) new bool:dmplayers[MAX_PLAYERS]
//when they join (set this for each player when the dm starts) dmplayer[playerid] = true; //is in dm //in timer for example for(new i=0;i<MAX_PLAYERS;i++){//loops all the connected players and set the var for them if(IsPlayerConnected(i))dmplayer[i] = true; }
//when they die (do this onplayerdeath) dmplayer[playerid] = false; //not in dm
//and each time a player dies when the dm is running check how many are left (then do this on player death but should be only if the dm is running) new test; for(new i=0;i<MAX_PLAYERS;i++) {//this checks all players on server where i counts from 0 - MAX_PLAYERS and sees if therein the DM if(dmplayer[i] == true) test++//adds 1 to test if they are } if(test == 1){//if there is only 1 player in there //found the winner end dm and announce and award etc SendClientMessage or whatever }
|
make any more sence?
Re: Event! -
ColdXX - 29.05.2010
Good!
Thank you
Re: Event! -
ColdXX - 29.05.2010
Ok so i didnt have time to test it and i've tested it now!
The problem is that it only teleports me not the other players...why is that?:S
pawn Код:
public DM(playerid)
{
dmplayers[playerid] = true;
new test;
{//this checks all players on server where i counts from 0 - MAX_PLAYERS and sees if therein the DM
if(dmplayers[playerid] == true) test++;//adds 1 to test if they are
}
if(test == 1){//if there is only 1 player in there
SendClientMessage(playerid,red,"Lol");
//found the winner end dm and announce and award etc SendClientMessage or whatever
}
new rand;
rand = random(2);
rand++ ;
switch(rand)
{
case 1: SetPlayerPos(playerid, 246.9834,1799.3242,7.4141);
case 2: SetPlayerPos(playerid, 254.3532,1816.3137,4.7109);
case 3: SetPlayerPos(playerid, 248.5833,1854.4525,8.7737);
}
GivePlayerWeapon(playerid,31,2000);
GivePlayerWeapon(playerid,24,2000);
GivePlayerWeapon(playerid,27,2000);
SetPlayerHealth(playerid,100);
SetPlayerArmour(playerid,100);
return 1;
}
OFF:I double Posted cuz else no one would have seen this