[Tutorial] How to make a /robshop cmd
#1

Hello todays tutorial is about how to make a robbery command in shops

so step one
we include streamer sscanf2 zcmd and ofcourse a_samp
pawn Code:
#include <a_samp>
#include <zcmd>
#include <sscanf2>
#include <streamer>
Second Step
We define the color
pawn Code:
#define COLOR_LIGHTBLUE 0x00E1FF
Third Step
we add the checkpoint variable so we can actually make a checkpoint put it on the top of your script
pawn Code:
new Checkpoint[20];
Fourth Step
we create the checkpoints inside OnGameModeInt here i will show you
pawn Code:
public OnGameModeInIt()
{
   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;
}
Five Step
we forward this put it on the top of the script as well but under the includes
pawn Code:
forward CityHallRobAgain(playerid);
Six Step
we create a public function called OnPlayerEnterDynamicCP
pawn Code:
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;
}
Seven Step
we create the command itself like this
pawn Code:
CMD:robshop(playerid,params[])
{
    if(IsPlayerInDynamicCP(playerid,Checkpoint[5]))
    {
       SetPVarInt(playerid, "RobbingCityHall", 30);
       SetPVarInt(playerid, "CityHallRobbedRecently", 1);
       IncreaseWantedLevel(playerid,4);
       @Robbing1(playerid);
       return 1;
    }
    return 1;
}
Eight Step
As you can see there is a robbing1 there this is the timer when your robbing the shop
pawn Code:
@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);
      IncreaseScore(playerid,1);
      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;
}
Last step
we need to add this public function
pawn Code:
public CityHallRobAgain(playerid)
{
   if(GetPVarInt(playerid, "CityHallRobbedRecently") == 1)
   {
       SetPVarInt(playerid, "CityHallRobbedRecently", 0);
       return 1;
   }
   return 1;
}
Hope it helped you
Reply
#2

pawn Code:
#include "streamer"
Seriously? Some noob can do <streamer>..


pawn Code:
#define COLOR_LIGHTBLUE
Where's the hex code?

Looks like a copy-paste, fix and explain!
Reply
#3

It as actually a copy paste but i fully made it in pawn
by myself and i just first explained and then paste it so its like
every normal tutorial so its okay
and thanks about your thought it will pretty alret me next time i post a tutorial

[EDIT] i will explain more in the next day
Reply
#4

*cough*
pawn Code:
#include "streamer"
to:
pawn Code:
#include <streamer>
Also https://sampforum.blast.hk/showthread.php?tid=470045
Why would you post a tutorial if YOU don't know what are you doing..?
Reply
#5

Quote:
Originally Posted by iZN
View Post
*cough*
pawn Code:
#include "streamer"
to:
pawn Code:
#include <streamer>
Also https://sampforum.blast.hk/showthread.php?tid=470045
Why would you post a tutorial if YOU don't know what are you doing..?
I got a new problem when i tryed to make a new thing in the command i clearly know how to make it
but i had a problem with something that i wanted to add to my own script
Reply
#6

LOL:

Code:
C:\Users\12123232\Desktop\My Scripting2\gamemodes\textdraws.pwn(44) : error 017: undefined symbol "Checkpoint"
C:\Users\12123232\Desktop\My Scripting2\gamemodes\textdraws.pwn(44) : warning 215: expression has no effect
C:\Users\12123232\Desktop\My Scripting2\gamemodes\textdraws.pwn(44) : error 001: expected token: ";", but found "]"
C:\Users\12123232\Desktop\My Scripting2\gamemodes\textdraws.pwn(44) : error 029: invalid expression, assumed zero
C:\Users\12123232\Desktop\My Scripting2\gamemodes\textdraws.pwn(44) : fatal error 107: too many error messages on one line
My Line 44:

Code:
	Checkpoint[3] = CreateDynamicCP(1481.0745,-1772.3140,18.7958,2,-1,-1,-1,30);//City Hall Enter
Reply
#7

add this in the top of the script below includes and defines

pawn Code:
new Checkpoint[20];
As i can see you didnt follow the tutorial and just copy paste
Reply
#8

Quote:
Originally Posted by DarkLored
View Post
Hello todays tutorial is about how to make a robbery command in shops

so step one
we include streamer sscanf2 zcmd and ofcourse a_samp
pawn Code:
#include <a_samp>
#include <zcmd>
#include <sscanf2>
#include <streamer>
Second Step
We define the color
pawn Code:
#define COLOR_LIGHTBLUE 0x00E1FF
Third Step
we add the checkpoint variable so we can actually make a checkpoint put it on the top of your script
pawn Code:
new Checkpoint[20];
Fourth Step
we create the checkpoints inside OnGameModeInt here i will show you
pawn Code:
public OnGameModeInIt()
{
   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;
}
Five Step
we forward this put it on the top of the script as well but under the includes
pawn Code:
forward CityHallRobAgain(playerid);
Six Step
we create a public function called OnPlayerEnterDynamicCP
pawn Code:
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;
}
Seven Step
we create the command itself like this
pawn Code:
CMD:robshop(playerid,params[])
{
    if(IsPlayerInDynamicCP(playerid,Checkpoint[5]))
    {
       SetPVarInt(playerid, "RobbingCityHall", 30);
       SetPVarInt(playerid, "CityHallRobbedRecently", 1);
       IncreaseWantedLevel(playerid,4);
       @Robbing1(playerid);
       return 1;
    }
    return 1;
}
Eight Step
As you can see there is a robbing1 there this is the timer when your robbing the shop
pawn Code:
@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);
      IncreaseScore(playerid,1);
      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;
}
Last step
we need to add this public function
pawn Code:
public CityHallRobAgain(playerid)
{
   if(GetPVarInt(playerid, "CityHallRobbedRecently") == 1)
   {
       SetPVarInt(playerid, "CityHallRobbedRecently", 0);
       return 1;
   }
   return 1;
}
Hope it helped you
hi!
I want add command robbery one cabinet money use command bump receive the new money help
Reply
#9

Quote:
Originally Posted by rynhok2
View Post
hi!
I want add command robbery one cabinet money use command bump receive the new money help
I am sorry, I out of everyone shouldn't complain at one's English but lol. I couldn't understand anything there. I am surprised I found a "I" capitalized. Could you rewrite that sentence please and we might just be able to help you. :P
Reply
#10

Quote:
Originally Posted by Hansrutger
View Post
I am sorry, I out of everyone shouldn't complain at one's English but lol. I couldn't understand anything there. I am surprised I found a "I" capitalized. Could you rewrite that sentence please and we might just be able to help you. :P
I'am sorry !!!!!!
Vietnam I said I was not good at english!
I want to add the command to use the bomb robbery
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)