Author Topic: Need scripting help  (Read 1210 times)

Offline Doc.

  • Development Team
  • Hero Member
  • *****
  • Posts: 637
  • cookies: 22
  • IG name: Doc.
Need scripting help
« on: February 12, 2017, 10:14 »
Hi i need a cmd /setnight to set darkness on my test sv because it doesnt have that day/night thing its always day.I have no idea how to script this so if u can help me please do it C:-)
Quote from: TiPiR
trolldock

Offline Dr_Alio

  • VIP
  • Respected Trucker
  • *****
  • Posts: 125
  • cookies: 8
  • Wizard
  • IG name: Dr_Alio
Re: Need scripting help
« Reply #1 on: February 12, 2017, 10:41 »
Something like this
Code: [Select]
CMD:settime(playerid, params[])
{
    new time, string[128];
    if(sscanf(params, "i", time)) return SendClientMessage(playerid, -1, "Usage: /settime [time]");
    if(time > 24 || time < 0) return SendClientMessage(playerid, -1, "Error: Invalid time!");
    SetWorldTime(time);
    format(string, sizeof(string), "Time set to %d", time);
    SendClientMessage(playerid, 0x00FF00FF, string);
    return 1;
}
or
Code: [Select]
CMD:setnight(playerid, params[])
{
    SetWorldTime(0); //midnight
    SendClientMessage(playerid, 0x00FF00FF, "Time set to midnight.");
    return 1;
}
LAST SEEN
TOTAL TIME ON SERVER
SCORE
TRUCK LOADS
CONVOY SCORE
ACHIEVEMENTS
ARTIC
DUMPER
VAN
FUEL
CEMENT
ARRESTS
CARS STOLEN
COACH
PLANE
HELICOPTER
TOW TRUCK
LIMO
TRASH
ARMORED VAN
BURGLARIES
ARMORED VANS STOLEN

Offline Doc.

  • Development Team
  • Hero Member
  • *****
  • Posts: 637
  • cookies: 22
  • IG name: Doc.
Re: Need scripting help
« Reply #2 on: February 12, 2017, 11:13 »
The second one looks easier, where do i input that?i mean which part of gamemod?
Quote from: TiPiR
trolldock

Offline Dr_Alio

  • VIP
  • Respected Trucker
  • *****
  • Posts: 125
  • cookies: 8
  • Wizard
  • IG name: Dr_Alio
Re: Need scripting help
« Reply #3 on: February 12, 2017, 11:36 »
Just put it somewhere. I always have all the commands at the end of the code.
Code: [Select]
....
....
....
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}

CMD:setnight(playerid, params[])
{
    SetWorldTime(0); //midnight
    SendClientMessage(playerid, 0x00FF00FF, "Time set to midnight.");
    return 1;
}
And you need to include
Code: [Select]
#include <zcmd>
LAST SEEN
TOTAL TIME ON SERVER
SCORE
TRUCK LOADS
CONVOY SCORE
ACHIEVEMENTS
ARTIC
DUMPER
VAN
FUEL
CEMENT
ARRESTS
CARS STOLEN
COACH
PLANE
HELICOPTER
TOW TRUCK
LIMO
TRASH
ARMORED VAN
BURGLARIES
ARMORED VANS STOLEN

Offline Doc.

  • Development Team
  • Hero Member
  • *****
  • Posts: 637
  • cookies: 22
  • IG name: Doc.
Re: Need scripting help
« Reply #4 on: February 12, 2017, 11:57 »
grandlarc.pwn(14) : fatal error 100: cannot read from file: "zcmd"
Quote from: TiPiR
trolldock

Offline Dr_Alio

  • VIP
  • Respected Trucker
  • *****
  • Posts: 125
  • cookies: 8
  • Wizard
  • IG name: Dr_Alio
Re: Need scripting help
« Reply #5 on: February 12, 2017, 12:05 »
Well yea cuz you need to add http://forum.sa-mp.com/showthread.php?t=91354 zcmd in to include folder of pawn
LAST SEEN
TOTAL TIME ON SERVER
SCORE
TRUCK LOADS
CONVOY SCORE
ACHIEVEMENTS
ARTIC
DUMPER
VAN
FUEL
CEMENT
ARRESTS
CARS STOLEN
COACH
PLANE
HELICOPTER
TOW TRUCK
LIMO
TRASH
ARMORED VAN
BURGLARIES
ARMORED VANS STOLEN

Offline Doc.

  • Development Team
  • Hero Member
  • *****
  • Posts: 637
  • cookies: 22
  • IG name: Doc.
Re: Need scripting help
« Reply #6 on: February 12, 2017, 12:08 »
Well yea cuz you need to add http://forum.sa-mp.com/showthread.php?t=91354 zcmd in to include folder of pawn
U got team viewer? Dont want to fck everything up Carl worked a lot to fix my streamer
Quote from: TiPiR
trolldock

Offline CarlJohnson

  • Administrator
  • Hero Member
  • ******
  • Posts: 3,193
  • cookies: 85
  • Server Scripter
  • IG name: CarlJohnson
Re: Need scripting help
« Reply #7 on: February 12, 2017, 13:43 »
Just download zcmd from SAMP forums and put it into /includes folder then include it in gamemode using #include <zcmd>, also you need sccanf 2 plugin file for 1st commad.

LAST SEEN
TOTAL TIME ON SERVER
SCORE
TRUCK LOADS
CONVOY SCORE
ACHIEVEMENTS
ARTIC
DUMPER
VAN
FUEL
CEMENT
ARRESTS
CARS STOLEN
COACH
PLANE
HELICOPTER
TOW TRUCK
LIMO
TRASH
ARMORED VAN

Offline CarlJohnson

  • Administrator
  • Hero Member
  • ******
  • Posts: 3,193
  • cookies: 85
  • Server Scripter
  • IG name: CarlJohnson
Re: Need scripting help
« Reply #8 on: February 12, 2017, 16:25 »
Well to avoid using ZCMD, you can do this.
Code: [Select]
public OnPlayerCommandText(playerid, cmdtext[])
{
     if(strcmp(cmdtext, "/night") == 0)
     {
         SetWorldTime(0); // or 12 'o clock
         SendClientMessage(playerid, 0x00FF00FF, "Time set to midnight.");
         return 1;
     }
     return 0;
}
LAST SEEN
TOTAL TIME ON SERVER
SCORE
TRUCK LOADS
CONVOY SCORE
ACHIEVEMENTS
ARTIC
DUMPER
VAN
FUEL
CEMENT
ARRESTS
CARS STOLEN
COACH
PLANE
HELICOPTER
TOW TRUCK
LIMO
TRASH
ARMORED VAN

Offline Doc.

  • Development Team
  • Hero Member
  • *****
  • Posts: 637
  • cookies: 22
  • IG name: Doc.
Re: Need scripting help
« Reply #9 on: February 12, 2017, 17:07 »
Well to avoid using ZCMD, you can do this.
Code: [Select]
public OnPlayerCommandText(playerid, cmdtext[])
{
     if(strcmp(cmdtext, "/night") == 0)
     {
         SetWorldTime(0); // or 12 'o clock
         SendClientMessage(playerid, 0x00FF00FF, "Time set to midnight.");
         return 1;
     }
     return 0;
}
Alio is doing some things now to fix becuz he broke the server,stay in touch we'll need your help=)))
Quote from: TiPiR
trolldock

Offline Dr_Alio

  • VIP
  • Respected Trucker
  • *****
  • Posts: 125
  • cookies: 8
  • Wizard
  • IG name: Dr_Alio
Re: Need scripting help
« Reply #10 on: February 12, 2017, 17:16 »
CarlJohnson I had to update all includes and plugins and than it worked :D
LAST SEEN
TOTAL TIME ON SERVER
SCORE
TRUCK LOADS
CONVOY SCORE
ACHIEVEMENTS
ARTIC
DUMPER
VAN
FUEL
CEMENT
ARRESTS
CARS STOLEN
COACH
PLANE
HELICOPTER
TOW TRUCK
LIMO
TRASH
ARMORED VAN
BURGLARIES
ARMORED VANS STOLEN

Offline Doc.

  • Development Team
  • Hero Member
  • *****
  • Posts: 637
  • cookies: 22
  • IG name: Doc.
Re: Need scripting help
« Reply #11 on: February 12, 2017, 17:19 »
CarlJohnson I had to update all includes and plugins and than it worked :D
^^ Great job, without u or carl i would have never figured out this whole test server thing
Quote from: TiPiR
trolldock

Offline Ethan

  • VIP
  • Hero Member
  • *****
  • Posts: 15,850
  • cookies: 229
  • (V)(;,,;)(V)
  • IG name: Ethan.
Re: Need scripting help
« Reply #12 on: February 12, 2017, 20:22 »
without u or carl i would have never figured out this whole test server thing
and to think I cant get mine to work after two years of having it

Offline Martin

  • VIP
  • Sr. Member
  • *****
  • Posts: 354
  • cookies: 18
  • Wannabe Moderator
  • IG name: Martinio
Re: Need scripting help
« Reply #13 on: February 13, 2017, 04:57 »
without u or carl i would have never figured out this whole test server thing
and to think I cant get mine to work after two years of having it

 :biggrin:
LAST SEEN
TOTAL TIME ON SERVER
SCORE
TRUCK LOADS
CONVOY SCORE
ACHIEVEMENTS
ARTIC
DUMPER
VAN
FUEL
CEMENT
ARRESTS
CARS STOLEN
COACH
PLANE
HELICOPTER
TOW TRUCK
LIMO
TRASH
ARMORED VAN
BURGLARIES
ARMORED VANS STOLEN
MISSIONS FAILED
OVERLOADED
FINES PAID
TOTAL SPENT ON FUEL
INTEREST EARNED
DISTANCE TRAVELLED
TIME IN JAIL
LAST MISSION

Offline Dobby

  • Hero Member
  • *****
  • Posts: 4,679
  • cookies: 120
  • No longer active.
Re: Need scripting help
« Reply #14 on: February 13, 2017, 05:22 »
SA:MP scripting is one of the easiest things to learn. Message me on Steam if you like Ethan.
I have left SA:MP behind.