Weird Checkpoint Problems
#1

Okey, basically these days i've been having problems with checkpoints. I've created them preety good and used different tutorials and everything and it still didn't work.

Wierd thing: The checkpoints from inside and outside works fine but thing is when i try to go in the robbery checkpoint and type the command that was maybe /robpizza or /robstore. Nothing happens.

The only thing that pops up is the message to robstore but the timer doesn't start and nothing. If you'd like pictures of this tell me cause it's wierd as hell and i can't figure out the problem.


My first one was this:

pawn Код:
#include <a_samp>
#include <streamer>
#include <zcmd>

#define COLOR_RED 0xFF0000AA
#define COLOR_BLUE 0x0000FFAA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_GREEN 0x33AA33AA
#define COL_WHITE "{FFFFFF}"
#define COL_RED "{F81414}"
#define COL_GREEN "{00FF22}"
#define COL_LIGHTBLUE "{00CED1}"
#define COLOR_ORANGE 0xFFA500AA

new CP_pizza; // The name of the checkpoint add whatever you want :)
new ROBBING_PIZZA[MAX_PLAYERS]; //used when you rob
new pizzarobbedrecently =0; // to make the players wait before robbing more

stock GivePlayerScore( playerid, score ) SetPlayerScore( playerid, GetPlayerScore( playerid ) + score );

forward ServerRobbery();

public OnFilterScriptInit()
{
    SetTimer("ServerRobbery",1000,1);// Ticks every 1 second
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    return 1;
}

public OnPlayerConnect(playerid)
{
    CP_pizza = CreateDynamicCP( 378.2259, -114.4946, 1001.4922, 2.0, .interiorid = 5);
    return 1;
}

public OnPlayerEnterDynamicCP(playerid, checkpointid) //Add this anywhere
{
   if(checkpointid == CP_pizza) //Checking if player is in the checkpoint "Tatoo"
   {
    SendClientMessage(playerid, COLOR_RED, "Start robbery by typing /robpizza"); //Sending message so that player knows that to rob. he must type this command
   }
   return 1;
}

CMD:robpizza(playerid, params[])
{
    if(IsPlayerInDynamicCP(playerid, CP_pizza)) // Checking if player is in the checkpoint
    {
        if(pizzarobbedrecently >=1) //checking if tatoo shop has been robbed recently
        {
            SendClientMessage(playerid, COLOR_RED, "Well Stacked Pizza has been robbed recently"); // sending error message
        }
        ROBBING_PIZZA[playerid] = 60; // setting the robbery timer
        pizzarobbedrecently =180; // Time the players needs to wait for starting an another robbery in the same place
    }
    return 1;
}

public ServerRobbery()
{
        for(new i=0; i<MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i)) // checking if player connected
            {
                //ROBBERIES
                if(ROBBING_PIZZA[i] > 1) // Checking if robbery time is above 1
                {
                    ROBBING_PIZZA[i] --; // Decreasing time
                    new time[20]; //adding time variable
                    format(time,sizeof(time),"Robbery Time: %d",ROBBING_PIZZA[i]);
                    GameTextForPlayer(i,time,500,3); //shows gametext showing the time remaining for the robbery
                }
                if(ROBBING_PIZZA[i] == 1) // IF the timer reached 1
                {
                    new string[64], pName[MAX_PLAYER_NAME];// getting player name
                    GetPlayerName(i,pName,MAX_PLAYER_NAME);
                    SendClientMessage(i, COLOR_GREEN, "Robbery Complete"); //sending message to the player that robbery was complete
                    SetPlayerWantedLevel(i, GetPlayerWantedLevel(i) + 1); //giving player 1 wanted level
                    ROBBING_PIZZA[i] =0; // RESET timer
                    new mrand =random(50000);
                    GivePlayerScore(i,1);
                    format(string,sizeof(string),"[ROBBERY] %s(%d) has robbed a total of $%d from Well Stacked Pizza!",pName,i,mrand);
                    SendClientMessageToAll(COLOR_RED,string);
                    GivePlayerMoney(i, mrand);
                }
            }
        }
        return 1;
}

public OnPlayerLeaveDynamicCP(playerid, checkpointid)
{
    if(checkpointid == CP_pizza) // checking if the player is leaving the CP tatoo
    {
        if(ROBBING_PIZZA[playerid] >= 1) //checking if the person was robbing and his robbery timer was above 1
        {
            SendClientMessage(playerid, COLOR_RED, "[ERROR]Robbery Failed"); //Error message that he failed
            ROBBING_PIZZA[playerid] =0; // Setting Robbing_tatoo to 0. to stop the counter
            return 1;
        }
    }
    return 1;
}

//    #pragma unused params // we dont need the params
I've had the second one that was :

pawn Код:
#include <a_samp>
#include <zcmd>
#include <sscanf2>
#include <streamer>

forward CityHallRobAgain(playerid);

#define COLOR_LIGHTBLUE 0x00E1FF

new Checkpoint[20];

public OnFilterScriptInit()
{
    Checkpoint[3] = CreateDynamicCP(1481.0745,-1772.3140,18.7958,2,-1,-1,-1,30);//City Hall Enter
    Checkpoint[4] = CreateDynamicCP(390.7699,173.8530,1008.3828,2,-1,3,-1,100);//City Hall Exit
    Checkpoint[5] = CreateDynamicCP(361.9961,173.6242,1008.3828,3,-1,3,-1,100);//City Hall Robbery Place
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
        if(checkpointid == Checkpoint[3])
    {
       SendClientMessage(playerid, COLOR_LIGHTBLUE, "Welcome to Los Santos City Hall");
       SetPlayerInterior(playerid,3);
       SetPlayerPos(playerid,387.5708,173.8486,1008.3828);
       SetPlayerFacingAngle(playerid,89.2370);
    }
        if(checkpointid == Checkpoint[4])
    {
       SetPlayerInterior(playerid,0);
       SetPlayerPos(playerid,1481.4359,-1768.5748,18.7958);
       SetPlayerFacingAngle(playerid,2.7449);
    }
        if(checkpointid == Checkpoint[5])
    {
       SendClientMessage(playerid,COLOR_LIGHTBLUE,"Type /robshop to start a robbbery!");
    }
        return 1;
}

CMD:robshop(playerid,params[])
{
    if(IsPlayerInDynamicCP(playerid,Checkpoint[5]))
    {
       SetPVarInt(playerid, "RobbingCityHall", 30);
       SetPVarInt(playerid, "CityHallRobbedRecently", 1);
       //
       @Robbing1(playerid);
       return 1;
    }
    return 1;
}

@Robbing1(playerid);
@Robbing1(playerid)
{
    new mrand =random(GetPlayerMoney(playerid));
    new string[120];
    new Time = GetPVarInt(playerid, "RobbingCityHall");
    if(!IsPlayerConnected(playerid))
        return 0;

    if(Time < 1)
    {
      SetPVarInt(playerid, "RobbingCityHall", 0);
      SetTimer("CityHallRobAgain", 360000, 0);
      GivePlayerMoney(playerid,mrand);
      //
      format(string,sizeof(string),"You have succesfully robbed $%d",mrand,playerid);
      return SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
    }

    new str[30];
    format(str, sizeof(str), "Robbery time left: %d", Time);
    GameTextForPlayer(playerid, str, 2500, 3); // Change it if you want

    SetPVarInt(playerid, "RobbingCityHall", Time - 1); // Decrease the player's jail time
    SetTimerEx("@Robbing1", 1000, false, "i", playerid);
    return 1;
}

public CityHallRobAgain(playerid)
{
   if(GetPVarInt(playerid, "CityHallRobbedRecently") == 1)
   {
       SetPVarInt(playerid, "CityHallRobbedRecently", 0);
       return 1;
   }
   return 1;
}

//IncreaseWantedLevel(playerid,4);
//IncreaseScore(playerid,1);
Reply
#2

You didn't create the Dynamic CP right.
pawn Код:
public OnPlayerConnect(playerid)
{
    CP_pizza = CreateDynamicCP( 378.2259, -114.4946, 1001.4922, 2.0,-1, -1, -1, 40.0););
    return 1;
}
pawn Код:
CMD:robpizza(playerid, params[])
{
    if(!IsPlayerInDynamicCP(playerid, CP_pizza)) return SendClientMessage(playerid, COLOR_RED,"You are not in ....");
    {
        if(pizzarobbedrecently >=1) //checking if tatoo shop has been robbed recently
        {
            SendClientMessage(playerid, COLOR_RED, "Well Stacked Pizza has been robbed recently"); // sending error message
        }
        ROBBING_PIZZA[playerid] = 60; // setting the robbery timer
        pizzarobbedrecently =180; // Time the players needs to wait for starting an another robbery in the same place
    }
    return 1;
}
Reply
#3

Quote:
Originally Posted by Clad
Посмотреть сообщение
You didn't create the Dynamic CP right.
pawn Код:
public OnPlayerConnect(playerid)
{
    CP_pizza = CreateDynamicCP( 378.2259, -114.4946, 1001.4922, 2.0,-1, -1, -1, 40.0););
    return 1;
}
pawn Код:
CMD:robpizza(playerid, params[])
{
    if(!IsPlayerInDynamicCP(playerid, CP_pizza)) return SendClientMessage(playerid, COLOR_RED,"You are not in ....");
    {
        if(pizzarobbedrecently >=1) //checking if tatoo shop has been robbed recently
        {
            SendClientMessage(playerid, COLOR_RED, "Well Stacked Pizza has been robbed recently"); // sending error message
        }
        ROBBING_PIZZA[playerid] = 60; // setting the robbery timer
        pizzarobbedrecently =180; // Time the players needs to wait for starting an another robbery in the same place
    }
    return 1;
}
Can you atleast make me an example please, i really need this
Reply
#4

help pls!
Reply
#5

bump
Reply
#6

Can someone help me please as fast as they can
Reply
#7

Quote:
Originally Posted by Clad
Посмотреть сообщение
You didn't create the Dynamic CP right.
pawn Код:
public OnPlayerConnect(playerid)
{
    CP_pizza = CreateDynamicCP( 378.2259, -114.4946, 1001.4922, 2.0,-1, -1, -1, 40.0););
    return 1;
}
pawn Код:
CMD:robpizza(playerid, params[])
{
    if(!IsPlayerInDynamicCP(playerid, CP_pizza)) return SendClientMessage(playerid, COLOR_RED,"You are not in ....");
    {
        if(pizzarobbedrecently >=1) //checking if tatoo shop has been robbed recently
        {
            SendClientMessage(playerid, COLOR_RED, "Well Stacked Pizza has been robbed recently"); // sending error message
        }
        ROBBING_PIZZA[playerid] = 60; // setting the robbery timer
        pizzarobbedrecently =180; // Time the players needs to wait for starting an another robbery in the same place
    }
    return 1;
}
Bob, In your first one, Change those, Change OnPlayerConnect with mine, And change your rob command.
Reply
#8

Quote:
Originally Posted by Clad
Посмотреть сообщение
Bob, In your first one, Change those, Change OnPlayerConnect with mine, And change your rob command.
filterscripts\robberyx2.pwn(44) : error 029: invalid expression, assumed zero
filterscripts\robberyx2.pwn(44) : warning 215: expression has no effect
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.


Line:

pawn Код:
CP_pizza = CreateDynamicCP( 378.2259, -114.4946, 1001.4922, 2.0, -1, -1, -1, 40.0););
Reply
#9

pawn Код:
CP_pizza = CreateDynamicCP( 378.2259, -114.4946, 1001.4922, 2.0, -1, -1, -1, 40.0);
Reply
#10

pawn Код:
CMD:robpizza(playerid, params[])
{
    if(!IsPlayerInDynamicCP(playerid, CP_pizza)) return SendClientMessage(playerid, COLOR_RED,"You are not in ....");
    if(IsPlayerInDynamicCP(playerid, CP_pizza))
    {
        if(pizzarobbedrecently >=1) //checking if tatoo shop has been robbed recently
        {
            SendClientMessage(playerid, COLOR_RED, "Well Stacked Pizza has been robbed recently"); // sending error message
        }
        ROBBING_PIZZA[playerid] = 60; // setting the robbery timer
        pizzarobbedrecently =180; // Time the players needs to wait for starting an another robbery in the same place
    }
    return 1;
}
Maybe can help you or maybe not but can work
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)