KillAll problem....
#1

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...
Reply
#2

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().
Reply
#3

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...
Reply
#4

...:::///===>>>BUMP<<<===\\\:::...
Reply
#5

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);
    }
}
Reply
#6

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;
}
Reply
#7

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


Forum Jump:


Users browsing this thread: 2 Guest(s)