SA-MP Forums Archive
KillAll problem.... - 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: KillAll problem.... (/showthread.php?tid=194489)



KillAll problem.... - [MNC]Azz - 29.11.2010

So yea.... i have a problem with this function...
heres a part on my script im making....

pawn Код:
public TeamsKills()
{
if(TeamREDKills >= 2 && TeamREDKills > TeamBLUEKills)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
GameTextForAll("~y~TEAM ~r~RED ~g~WON!!!~n~~y~Switching Map...",5000,3);
SetTimer("MapChange",5000,false);
TeamBLUEKills = 0;
TeamREDKills = 0;
TogglePlayerControllable(i,false);
return 1;
}
return 1;
}
else if(TeamBLUEKills >= 2 && TeamBLUEKills > TeamREDKills)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
GameTextForAll("~y~TEAM ~b~BLUE ~g~WON!!!~n~~y~Switching Map...",5000,3);
SetTimer("MapChange",5000,false);
TeamBLUEKills = 0;
TeamREDKills = 0;
TogglePlayerControllable(i,false);
return 1;
}
return 1;
}
return 1;
}

forward MapChange();
public MapChange()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
new rand = random(3);
switch (rand)
{
case 0:MArea69 = 1,MBuildyard = 0,MHarbour = 0,SendClientMessageToAll(COLOR_ORANGE,"Map Has Changed to Area69...");
case 1:MBuildyard = 1,MArea69 = 0,MHarbour = 0,SendClientMessageToAll(COLOR_ORANGE,"Map Has Changed to BuildYard...");
case 2:MHarbour = 1,MArea69 = 0,MBuildyard = 0,SendClientMessageToAll(COLOR_ORANGE,"Map Has Changed to Harbour...");
}
SetPlayerScore(i,0);
SetPlayerHealth(i,0.0);
return 1;
}
return 1;
}
wt im trying to do is to kill every1 when the map changes so that they will spawn in a different place...
but when i test it with my friend.... it works on me... but not on him!... i havent tested it with more than 2 ppl yet...
btw my friend dont cheat so its not him thats the problem....

it would be nice if somebody helped... what have i done wrong in this script?
if a thread similar to this has already been posted plz reply with tha link coz the forum is too big to search for this...

EDIT: posted bigger part of my code...


Re: KillAll problem.... - NewYorkRP - 29.11.2010

Not sure, but instead of MapChange (playerid), set it to MapChange() ?

and if that doesn't work ..

stock MapChange()

And when you want to change the map, with or an admin command or something, simply MapChange().


Re: KillAll problem.... - [MNC]Azz - 29.11.2010

It didnt work...
heres a bigger part of my code:
pawn Код:
public TeamsKills()
{
if(TeamREDKills >= 2 && TeamREDKills > TeamBLUEKills)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
GameTextForAll("~y~TEAM ~r~RED ~g~WON!!!~n~~y~Switching Map...",5000,3);
SetTimer("MapChange",5000,false);
TeamBLUEKills = 0;
TeamREDKills = 0;
TogglePlayerControllable(i,false);
return 1;
}
return 1;
}
else if(TeamBLUEKills >= 2 && TeamBLUEKills > TeamREDKills)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
GameTextForAll("~y~TEAM ~b~BLUE ~g~WON!!!~n~~y~Switching Map...",5000,3);
SetTimer("MapChange",5000,false);
TeamBLUEKills = 0;
TeamREDKills = 0;
TogglePlayerControllable(i,false);
return 1;
}
return 1;
}
return 1;
}

forward MapChange();
public MapChange()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
new rand = random(3);
switch (rand)
{
case 0:MArea69 = 1,MBuildyard = 0,MHarbour = 0,SendClientMessageToAll(COLOR_ORANGE,"Map Has Changed to Area69...");
case 1:MBuildyard = 1,MArea69 = 0,MHarbour = 0,SendClientMessageToAll(COLOR_ORANGE,"Map Has Changed to BuildYard...");
case 2:MHarbour = 1,MArea69 = 0,MBuildyard = 0,SendClientMessageToAll(COLOR_ORANGE,"Map Has Changed to Harbour...");
}
SetPlayerScore(i,0);
SetPlayerHealth(i,0.0);
return 1;
}
return 1;
}
It doesnt freeze every1 eather...


Re: KillAll problem.... - [MNC]Azz - 29.11.2010

...:::///===>>>BUMP<<<===\\\:::...


Re: KillAll problem.... - MadeMan - 29.11.2010

Too many returns

pawn Код:
public TeamsKills()
{
    if(TeamREDKills >= 2 && TeamREDKills > TeamBLUEKills)
    {
        GameTextForAll("~y~TEAM ~r~RED ~g~WON!!!~n~~y~Switching Map...",5000,3);
        SetTimer("MapChange",5000,false);
        TeamBLUEKills = 0;
        TeamREDKills = 0;
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            TogglePlayerControllable(i,false);
        }
    }
    else if(TeamBLUEKills >= 2 && TeamBLUEKills > TeamREDKills)
    {
        GameTextForAll("~y~TEAM ~b~BLUE ~g~WON!!!~n~~y~Switching Map...",5000,3);
        SetTimer("MapChange",5000,false);
        TeamBLUEKills = 0;
        TeamREDKills = 0;
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            TogglePlayerControllable(i,false);
        }
    }
    return 1;
}

forward MapChange();
public MapChange()
{
    new rand = random(3);
    switch (rand)
    {
        case 0:MArea69 = 1,MBuildyard = 0,MHarbour = 0,SendClientMessageToAll(COLOR_ORANGE,"Map Has Changed to Area69...");
        case 1:MBuildyard = 1,MArea69 = 0,MHarbour = 0,SendClientMessageToAll(COLOR_ORANGE,"Map Has Changed to BuildYard...");
        case 2:MHarbour = 1,MArea69 = 0,MBuildyard = 0,SendClientMessageToAll(COLOR_ORANGE,"Map Has Changed to Harbour...");
    }
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        SetPlayerScore(i,0);
        SetPlayerHealth(i,0.0);
    }
}



Re: KillAll problem.... - SuperS82 - 29.11.2010

pawn Код:
forward MapChange();
public MapChange()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        new rand = random(3);
        switch (rand)
        {
            case 0:MArea69 = 1,MBuildyard = 0,MHarbour = 0,SendClientMessageToAll(COLOR_ORANGE,"Map Has Changed to Area69...");
            case 1:MBuildyard = 1,MArea69 = 0,MHarbour = 0,SendClientMessageToAll(COLOR_ORANGE,"Map Has Changed to BuildYard...");
            case 2:MHarbour = 1,MArea69 = 0,MBuildyard = 0,SendClientMessageToAll(COLOR_ORANGE,"Map Has Changed to Harbour...");
        }
        SetPlayerScore(i,0);
        SetPlayerHealth(i,0.0);
        //return 1; <---This is not needed and stops i from counting up if called...
    }
    return 1;
}



Re: KillAll problem.... - [MNC]Azz - 01.12.2010

@MadeMan & @SuperS82
You guys really helped! Thanks A LOT!!!