Disable teleport to player
#1

Okay guys, i made a minigame in my script, and it works fine. Also i disabled that people can teleport OUT of a minigame.
My question is: How can i make it, that people canґt teleport INTO the minigame.

Here are the scripts of the minigame and the punishment when try to teleport out.

This is the minigame
pawn Код:
if (strcmp("/rocket", cmdtext, true) == 0)
{
MinigameParticipant[playerid]=1;  // let the system know that heґs in minigame
  ResetPlayerWeapons(playerid);
  SetPlayerHealth(playerid, 100);
    SetPlayerArmour(playerid,100);
    SendClientMessageToAll(0x828282FF, "Server: A player has joined the Rocket-Ramba-Zamba. Type /rocket  to join as well!");
    SendClientMessage(playerid, 0x007F00FF, "Have fun.");
    SetPlayerPos(playerid, -1396.8975,1249.1334,1039.8672);
    SetPlayerFacingAngle(playerid, 0);
 SetPlayerInterior(playerid, 16);
    SaveToFile("RocketLog",string);
    GivePlayerWeapon(playerid,35,10000);
    return 1;
}
System knows now:
pawn Код:
MinigameParticipant[playerid]=1;  // let the system know that heґs in minigame
So it gives punishment when try to teleport:

pawn Код:
if(strcmp("/taxi 0", cmdtext, true) == 0)

if (MinigameParticipant[playerid]==1)
{new Float:x, Float:y, Float:z;
  GetPlayerPos(playerid, x, y, z);
 CreateExplosion(x+random(5), y+random(5), z+random(5), 7, 10.0);
 SendClientMessage(playerid,red,"Do NEVER teleport out of minigames!!!! Thats annoying!!!");
 return 1;

(...)(my taxi location and some cash things...)
So now you know all i wrote. How can i make it now, that i cannot teleport TO a player who is IN a minigame.


I hope you understand what i mean.
Jeffry
Reply
#2

I dont understand what you mean with "teleport into minigame". Why shouldnt they be able to teleport?
Reply
#3

Just change the return 1; to return 0;.
Reply
#4

Quote:
Originally Posted by Mo3
Just change the return 1; to return 0;.
what should that bring me?


Should be like: If(playerisminigameparticipant(playerid) =1)

Do not tele to him...


but this wonґt work, so...?
Reply
#5

pawn Код:
if (strcmp("/rocket", cmdtext, true) == 0)
{
if(MinigameParticipant[playerid]!=1)
{
MinigameParticipant[playerid]=1;  // let the system know that heґs in minigame
  ResetPlayerWeapons(playerid);
  SetPlayerHealth(playerid, 100);
    SetPlayerArmour(playerid,100);
    SendClientMessageToAll(0x828282FF, "Server: A player has joined the Rocket-Ramba-Zamba. Type /rocket  to join as well!");
    SendClientMessage(playerid, 0x007F00FF, "Have fun.");
    SetPlayerPos(playerid, -1396.8975,1249.1334,1039.8672);
    SetPlayerFacingAngle(playerid, 0);
 SetPlayerInterior(playerid, 16);
    SaveToFile("RocketLog",string);
    GivePlayerWeapon(playerid,35,10000);
}
if(MinigameParticipant[playerid]==1)
{
SendClientMessage(playerid, COLOR_RED, "You suck XD");
}
    return 1;
}
You mean this way?!
Reply
#6

Ehehe, no i didnt mean this, but thx anyway, i didnt think about that. I will add that, but the problem still exists.



No, the problem is, that i have a Teleport command (/tp [id])
And you shouldnґt be able to teleport to a player whoґs in a minigame.
Do you need the teleport command to work with it?
Reply
#7

Would be good, yes.
Reply
#8

Okay, this is it.

pawn Код:
dcmd_tp(playerid,params[]) {
if (MinigameParticipant[playerid]==1)
{new Float:x, Float:y, Float:z;
  GetPlayerPos(playerid, x, y, z);
 CreateExplosion(x+random(5), y+random(5), z+random(5), 7, 10.0);
 SendClientMessage(playerid,red,"Do NEVER teleport out of minigames!!!! Thats annoying!!!");
}
    else
  {
  if(100000 < GetPlayerMoney(playerid)) {
      if(!strlen(params)) return SendClientMessage(playerid,red,"USAGE: /tp [playerid]");
      new player1, string[128];
        if(!IsNumeric(params)) player1 = ReturnPlayerID(params);
        else player1 = strval(params);
        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid) {
            CMDMessageToAdmins(playerid,"TP");
            new Float:x, Float:y, Float:z;  GetPlayerPos(player1,x,y,z); SetPlayerInterior(playerid,GetPlayerInterior(player1));
            SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(player1));
            if(GetPlayerState(playerid) == 2) {
                SetVehiclePos(GetPlayerVehicleID(playerid),x+3,y,z);    LinkVehicleToInterior(GetPlayerVehicleID(playerid),GetPlayerInterior(player1));
        GivePlayerMoney(playerid, -100000);
                SetVehicleVirtualWorld(GetPlayerVehicleID(playerid),GetPlayerVirtualWorld(player1));
            } else SetPlayerPos(playerid,x+2,y,z);
            GivePlayerMoney(playerid, -100000);
            format(string,sizeof(string),"You have teleported to \"%s\"", pName(player1));
            return SendClientMessage(playerid,blue,string);
        } else return SendClientMessage(playerid, red, "Player is not connected or is yourself");
    } else return SendClientMessage(playerid,red,"Sorry, you donґt have enaugh money to teleport. You need 100 000$ to teleport.");
    }
    return 1;}
How can i make it, that a player cannot teleport to a player whoґs in a minigame?
Reply
#9

paste this one into that code somewhere:

pawn Код:
if(MinigameParticipant[player1]==1)
{
SendClientMessage(playerid, COLOR_RED, "The Player you want to teleport to is currently in a minigame. Pls Try again Later.");
}
It just uses the ID, you saved in "player1" and pastes it into the array

I hope thats what you want XD
Reply
#10

Okay, i will try that after Bundesliga. (in 45 min). Iґl inform you then. Thx.

okay, thats what appears:

pawn Код:
C:\Users\Patrick und Marco\Desktop\Pawn - Kopie (3)\filterscripts\ladmin4v2.pwn(1141) : error 017: undefined symbol "player1"
1 Error.
Do i have to define or forward the player1?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)