How to teleport other player.... (Need help on other func. related to system)
#1

Ok, i got a command of a challenge to other player, the player who gets a challenge gets forwarded to dialog response callback, and if he presses yes it accepts the challenge, if no the no, my question is, how could i teleport the player who challenged him on Cmdtext callback while the challenged player is on DialogResponse callback? Hope u understood what i want ?
Reply
#2

You could make a variable to store ids of challenger and challenged.
pawn Код:
new Challenge[MAX_PLAYERS] = { INVALID_PLAYER_ID, ... };
Once challenger challenges the challenged:
pawn Код:
Challenge[playerid] = challengedid;
Challenge[challengedid] = playerid;
If challenged clicks YES:
pawn Код:
if(Challenge[Challenge[playerid]] == playerid) //This checks if challenger hasnt challenged someone else while challenged was thinking
{
  SetPlayerPos(playerid, x, y, z);
  SetPlayerPos(Challenge[playerid], x, y, z);
  //When challenge ends, set both players Challenge to INVALID_PLAYER_ID;
}
else
{
  SendClientMessage(playerid, WHITE, "This player has challenged someone while you were thinking.");
  Challenge[playerid] = INVALID_PLAYER_ID;
}
if challenged clicks NO:
pawn Код:
if(Challenge[Challenge[playerid]] == playerid)
{
  SendClientMessage(Challenge[playerid], WHITE, "Challenge cancelled..");
  Challenge[Challenge[playerid]] = INVALID_PLAYER_ID;
  Challenge[playerid] = INVALID_PLAYER_ID;
}
else
{
  Challenge[playerid] = INVALID_PLAYER_ID;
}
Well you get the idea..
Reply
#3

o_O, i don't understand anything now can u explain me more about it?

Code:


Removed cause worried of getting script copied.(solved)
Reply
#4

When you challenge(/drag) someone, your Challenge is set on challenged's(giveplayerid) id.
Код:
Challenge[playerid] = giveplayerid;
And the player, who you challenged, Challenge is set on your id.
Код:
Challenge[giveplayerid] = playerid;
Since Challenge[giveplayerid] stores now challengers id, its easy to teleport challenger and challenged to specific location OnDialogResponse...

I dont know how to explain that any better.. Its already explained as clearly as possible :\

Reply
#5

one more question,

How could i make like:

Код:
/drag [ID] [amount of money they will drag]
how could i do the amount of money they would drag?
Reply
#6

I suppose you have /givecash [playerid] [amount] command.. go see how its done there.
Reply
#7

I am almost done just one moooore thing, i made a bid changing system and i was wondering how could i do that player needs to write only NUMBERS?

edit: oh and
Код:
if(GetPlayerMoney(Challenged[Challenged[playerid]] < inputtext);
Getting bunch of errors cause of inputtext, any ideas?
Reply
#8

Quote:
Originally Posted by 0ne
how could i do that player needs to write only NUMBERS?
You need IsNumeric function. I think you can find it in dudb.inc

Quote:
Originally Posted by 0ne
Код:
if(GetPlayerMoney(Challenged[Challenged[playerid]] < inputtext);
Getting bunch of errors cause of inputtext, any ideas?
GetPlayerMoney returns an integrer and inputtext is a string. strval seperates numbers from letters:
Код:
if(GetPlayerMoney(Challenged[Challenged[playerid]]) < strval(inputtext))
You also had ")" missing there.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)