#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;
}
if(pickupablalbalbal)
{
if(isadmin)
{
// the things should do
}
else return SendClientMessage(... );
}
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(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
}
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 Код:
|
#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;
}
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.
#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;
}
You just had bad indentation.
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.
#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;
}
#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;
}