Quick question regarding how this should work..
#3

Quote:
Originally Posted by Nero_3D
Посмотреть сообщение
Lets stip that code to the important parts

pawn Код:
//offertp
Offer[Player][0] = playerid;
Offer[playerid][0] = Player;
//accepttp
for(new i = 0; i < cfg_SERVER_MAXPLAYERS; i++) {
    if(Offer[playerid][0] == Offer[i][0]) {
        GetPlayerPos(i, AdminPosition[0], AdminPosition[1], AdminPosition[2]);
        SetPlayerPos(playerid, AdminPosition[0], AdminPosition[1], AdminPosition[2]);
        Offer[playerid][0] = -1;
        Offer[i][0] = -1;
    }
}
So Offer[x] = y; and Offer[y] = x;
Alright now we loop through all players
And check if Offer[x] (which is y) is the same as Offer[i]
So this condition is only fulfilled if two players got an offer by y
And if its fulfilled than it teleports the command user to the other player who got an offer

pawn Код:
//offertp
Offer[Player][0] = playerid;
//accepttp
GetPlayerPos(Offer[playerid][0], AdminPosition[0], AdminPosition[1], AdminPosition[2]);
SetPlayerPos(playerid, AdminPosition[0], AdminPosition[1], AdminPosition[2]);
Offer[playerid][0] = -1;
Thank you very much -- Shortened my command by quite a bit aswell.
Reply


Messages In This Thread
Quick question regarding how this should work.. - by Skylar Paul - 10.05.2011, 13:10
AW: Quick question regarding how this should work.. - by Nero_3D - 10.05.2011, 14:51
Re: AW: Quick question regarding how this should work.. - by Skylar Paul - 10.05.2011, 14:56

Forum Jump:


Users browsing this thread: 1 Guest(s)