Enter House, Just for admin's! Help please!
#1

In this video i show what the problem is: [ame="http://www.youtube.com/watch?v=wVUKrNiOaKA"]How to fix that:[/ame]

Here is the PAWN code:
pawn Код:
#include <a_samp>

#define FILTERSCRIPT

#define COLOR_GREY 0xAFAFAFAA
#define COLOR_CRIMSON 0xDC143CAA

//Checkpoints
new EnterHouse, LeaveHouse;


public OnFilterScriptInit()
{
    print("\n-----------------------------------------");
    print(" Checkpoints By Larsey123");
    print("-------------------------------------------\n");

    //Checkpoints
    EnterHouse = CreatePickup(1273, 23, 966.84710693359,2133.0017089844,10.8203125);
    LeaveHouse = CreatePickup(1273, 23, 965.08758544922,-53.164505004883,1001.1245727539);

    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    if( pickupid == EnterHouse && IsPlayerAdmin(playerid))
    {
      SetPlayerPos(playerid,963.37561035156,-53.307209014893,1001.124572);
      SetPlayerInterior(playerid,  3 );
      SendClientMessage(playerid,COLOR_CRIMSON,"Welcome to the Admin House!");
      }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "You cannot enter, Just for admins!");
      }
    if( pickupid == LeaveHouse && IsPlayerAdmin(playerid))
    {
      SetPlayerPos(playerid,969.80432128906,2133.1311035156,10.8203);
      SetPlayerInterior(playerid,  0 );
      SendClientMessage(playerid,COLOR_CRIMSON,"You have left the Admin House!");
     }
    return 1;
 }
Reply
#2

easy, you see what you have done, i will explane.

in callback you have typed that if player is admin and pickup id is enterhouse then teleport.
Else if not then send that command.
But when leaving you are about to check first if player is entering so probably its not then it takes that else, so yep he is not entering the house and it shows that message up next it checks if player is leaving yep, it is, hes job is done.

So to fix that, ou need to check if is admin in other line inside the pickup checking.
pawn Код:
if(pickupablalbalbal)
{
      if(isadmin)
      {
           // the things should do
       }
       else return SendClientMessage(... );
}
Reply
#3

Quote:
Originally Posted by GaGlets®
Посмотреть сообщение
easy, you see what you have done, i will explane.

in callback you have typed that if player is admin and pickup id is enterhouse then teleport.
Else if not then send that command.
But when leaving you are about to check first if player is entering so probably its not then it takes that else, so yep he is not entering the house and it shows that message up next it checks if player is leaving yep, it is, hes job is done.

So to fix that, ou need to check if is admin in other line inside the pickup checking.
pawn Код:
if(pickupablalbalbal)
{
      if(isadmin)
      {
           // the things should do
       }
       else return SendClientMessage(... );
}
I am new with scripting so i dont understand can you please edit the script up there, and BTW it is the whole script.
Reply
#4

lol i knew that you will not understand me

So i gave a code example for you what you need to do.. by the way.. there are two good metods.. .
pawn Код:
if(pickupid == enterhouse)
{
    if(IsPlayerAdmin(playerid))
    // your codde.
    else
    // your message if not admin
}
else if(pickupid == exithouse)
{
    if(IsPlayerAdmin(playerid))
    // your codde.
    else
    // your message if not admin
}
Reply
#5

Quote:
Originally Posted by GaGlets®
Посмотреть сообщение
lol i knew that you will not understand me

So i gave a code example for you what you need to do.. by the way.. there are two good metods.. .
pawn Код:
if(pickupid == enterhouse)
{
    if(IsPlayerAdmin(playerid))
    // your codde.
    else
    // your message if not admin
}
else if(pickupid == exithouse)
{
    if(IsPlayerAdmin(playerid))
    // your codde.
    else
    // your message if not admin
}
I think i got it now:

pawn Код:
#include <a_samp>

#define FILTERSCRIPT

#define COLOR_CRIMSON 0xDC143CAA

//Checkpoints
new EnterHouse, LeaveHouse;


public OnFilterScriptInit()
{
    print("\n-----------------------------------------");
    print(" Checkpoints By Larsey123");
    print("-------------------------------------------\n");

    //Checkpoints
    EnterHouse = CreatePickup(1273, 23, 966.84710693359,2133.0017089844,10.8203125);
    LeaveHouse = CreatePickup(1273, 23, 965.08758544922,-53.164505004883,1001.1245727539);

    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
//EnterHouse
    if( pickupid == EnterHouse)
    {
        if(IsPlayerAdmin(playerid)==1)
      {
      SetPlayerPos(playerid,963.37561035156,-53.307209014893,1001.124572);
      SetPlayerInterior(playerid,  3 );
      SendClientMessage(playerid,COLOR_CRIMSON,"Welcome to the Admin House!");
}
    else return SendClientMessage(playerid,COLOR_CRIMSON,"You connot enter, Just for admins!");
    }

//LeaveHouse
    if( pickupid == LeaveHouse)
    {
      SetPlayerPos(playerid,969.80432128906,2133.1311035156,10.8203);
      SetPlayerInterior(playerid,  0 );
      SendClientMessage(playerid,COLOR_CRIMSON,"You have left the Admin House!");
}
    return 0;
    }
But i get 1 Error Messange
pawn Код:
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\House.pwn(35) : warning 217: loose indentation
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Warning.
Please correct me
Reply
#6

You just had bad indentation.

pawn Код:
#include <a_samp>

#define FILTERSCRIPT

#define COLOR_CRIMSON 0xDC143CAA

//Checkpoints
new EnterHouse, LeaveHouse;


public OnFilterScriptInit()
{
    print("\n-----------------------------------------");
    print(" Checkpoints By Larsey123");
    print("-------------------------------------------\n");

    //Checkpoints
    EnterHouse = CreatePickup(1273, 23, 966.84710693359,2133.0017089844,10.8203125);
    LeaveHouse = CreatePickup(1273, 23, 965.08758544922,-53.164505004883,1001.1245727539);

    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == EnterHouse)
    {
        if(IsPlayerAdmin(playerid)==1)
        {
            SetPlayerPos(playerid,963.37561035156,-53.307209014893,1001.124572);
            SetPlayerInterior(playerid,  3 );
            SendClientMessage(playerid,COLOR_CRIMSON,"Welcome to the Admin House!");
        }
    }
    else SendClientMessage(playerid,COLOR_CRIMSON,"You connot enter, Just for admins!");
    else if(pickupid == LeaveHouse)
    {
        SetPlayerPos(playerid,969.80432128906,2133.1311035156,10.8203);
        SetPlayerInterior(playerid,  0 );
        SendClientMessage(playerid,COLOR_CRIMSON,"You have left the Admin House!");
    }
    return 0;
}
Reply
#7

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
You just had bad indentation.

pawn Код:
#include <a_samp>

#define FILTERSCRIPT

#define COLOR_CRIMSON 0xDC143CAA

//Checkpoints
new EnterHouse, LeaveHouse;


public OnFilterScriptInit()
{
    print("\n-----------------------------------------");
    print(" Checkpoints By Larsey123");
    print("-------------------------------------------\n");

    //Checkpoints
    EnterHouse = CreatePickup(1273, 23, 966.84710693359,2133.0017089844,10.8203125);
    LeaveHouse = CreatePickup(1273, 23, 965.08758544922,-53.164505004883,1001.1245727539);

    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == EnterHouse)
    {
        if(IsPlayerAdmin(playerid)==1)
        {
            SetPlayerPos(playerid,963.37561035156,-53.307209014893,1001.124572);
            SetPlayerInterior(playerid,  3 );
            SendClientMessage(playerid,COLOR_CRIMSON,"Welcome to the Admin House!");
        }
    }
    else SendClientMessage(playerid,COLOR_CRIMSON,"You connot enter, Just for admins!");
    else if(pickupid == LeaveHouse)
    {
        SetPlayerPos(playerid,969.80432128906,2133.1311035156,10.8203);
        SetPlayerInterior(playerid,  0 );
        SendClientMessage(playerid,COLOR_CRIMSON,"You have left the Admin House!");
    }
    return 0;
}
That got 2 Errors
pawn Код:
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\CheckPoint.pwn(36) : error 029: invalid expression, assumed zero
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\CheckPoint.pwn(36) : warning 215: expression has no effect
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\CheckPoint.pwn(36) : error 001: expected token: ";", but found "if"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.
Reply
#8

Try:
pawn Код:
#include <a_samp>

#define FILTERSCRIPT

#define COLOR_GREY 0xAFAFAFAA
#define COLOR_CRIMSON 0xDC143CAA

//Checkpoints
new
    EnterHouse,
    LeaveHouse;

public
    OnFilterScriptInit()
{
    print("\n-----------------------------------------");
    print(" Checkpoints By Larsey123");
    print("-------------------------------------------\n");

    //Checkpoints
    EnterHouse = CreatePickup(1273, 23, 966.84710693359,2133.0017089844,10.8203125);
    LeaveHouse = CreatePickup(1273, 23, 965.08758544922,-53.164505004883,1001.1245727539);

    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
//*******
    if(pickupid == EnterHouse)
    {
        if(IsPlayerAdmin(playerid))
        {
            SetPlayerPos(playerid, 963.37561035156, -53.307209014893, 1001.124572);
            SetPlayerInterior(playerid, 3);
            SendClientMessage(playerid, COLOR_CRIMSON, "Welcome to the Admin House!");
        } else SendClientMessage(playerid, COLOR_GREY, "You cannot enter, Just for admins!");
    }
// ********
    if(pickupid == LeaveHouse)
    {
        SetPlayerPos(playerid, 969.80432128906, 2133.1311035156, 10.8203);
        SetPlayerInterior(playerid, 0);
        SendClientMessage(playerid, COLOR_CRIMSON, "You have left the Admin House!");
    }
    return 1;
}
Reply
#9

you just need to format the code properly so so every time you start a new logic level you move the code over 1 tab and when you close it back one tab easy
pawn Код:
#include <a_samp>

#define FILTERSCRIPT

#define COLOR_CRIMSON 0xDC143CAA

//Checkpoints
new EnterHouse, LeaveHouse;


public OnFilterScriptInit(){
    print("\n-----------------------------------------");
    print(" Checkpoints By Larsey123");
    print("-------------------------------------------\n");

    //Checkpoints
    EnterHouse = CreatePickup(1273, 23, 966.84710693359,2133.0017089844,10.8203125);
    LeaveHouse = CreatePickup(1273, 23, 965.08758544922,-53.164505004883,1001.1245727539);

    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid){
//EnterHouse
    if( pickupid == EnterHouse){
        if(IsPlayerAdmin(playerid)==1){
            SetPlayerPos(playerid,963.37561035156,-53.307209014893,1001.124572);
            SetPlayerInterior(playerid,  3 );
            SendClientMessage(playerid,COLOR_CRIMSON,"Welcome to the Admin House!");
        }
        else return SendClientMessage(playerid,COLOR_CRIMSON,"You connot enter, Just for admins!");
    }

//LeaveHouse
    if( pickupid == LeaveHouse){
        SetPlayerPos(playerid,969.80432128906,2133.1311035156,10.8203);
        SetPlayerInterior(playerid,  0 );
        SendClientMessage(playerid,COLOR_CRIMSON,"You have left the Admin House!");
    }
    return 0;
}
Reply
#10

Thanks, It helped alot
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)