10.05.2011, 13:10
Well, i'm trying to do this, and i'm not sure how I should go about doing it to prevent abuse, so.. Any ideas?
/AcceptTP is where i'm having the logic-block, and need help on.
I don't have a tester to help me test things, so i'm wondering if the above code will work. It logically should, but that doesn't always mean it does.
pawn Код:
COMMAND:offertp(playerid, params[]) {
new
string[128],
Player;
if(PVar[playerid][AuthLvl] > 0) {
if(sscanf(params, "u", Player)) {
UsageMessage(playerid, "OfferTP", "[Player ID]", "Offers a teleport to the specified user.");
return 1;
}
format(string, sizeof(string), "You have offered a teleport to %s! They must now accept it using /AcceptTP.", GetTheirName(Player));
SuccessMessage(playerid, string);
format(string, sizeof(string), "{55FF00}[OFFER] {FFFFFF}Administrator %s has offered you a teleport. You can accept it by using /AcceptTP.", GetTheirName(playerid));
SendClientMessage(Player, WHITE, string);
Offer[Player][0] = playerid;
Offer[playerid][0] = Player;
}
else return AuthError(playerid, 1);
return 1;
}
COMMAND:accepttp(playerid, params[]) {
new
Float:AdminPosition[4];
if(Offer[playerid][0] == -1)
return ErrorMessage(playerid, "You do not have a teleportation request.");
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;
}
}
return 1;
}
I don't have a tester to help me test things, so i'm wondering if the above code will work. It logically should, but that doesn't always mean it does.