News:

Server address: server.convoytrucking.net
Get SA-MP 0.3.7 here: Click Here to download SA-MP 0.3.7

Main Menu

Need scripting help

Started by Doc., February 12, 2017, 10:14

Doc.

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: TiPiRtrolldock

Dr_Alio

Something like this

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

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
MISSIONS FAILED
OVERLOADED
FINES PAID
TOTAL SPENT ON FUEL
INTEREST EARNED
DISTANCE TRAVELLED
TIME IN JAIL
LAST MISSION

Doc.

The second one looks easier, where do i input that?i mean which part of gamemod?
Quote from: TiPiRtrolldock

Dr_Alio

Just put it somewhere. I always have all the commands at the end of the code.

....
....
....
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 #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
MISSIONS FAILED
OVERLOADED
FINES PAID
TOTAL SPENT ON FUEL
INTEREST EARNED
DISTANCE TRAVELLED
TIME IN JAIL
LAST MISSION

Doc.

grandlarc.pwn(14) : fatal error 100: cannot read from file: "zcmd"
Quote from: TiPiRtrolldock

Dr_Alio

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
MISSIONS FAILED
OVERLOADED
FINES PAID
TOTAL SPENT ON FUEL
INTEREST EARNED
DISTANCE TRAVELLED
TIME IN JAIL
LAST MISSION

Doc.

Quote from: Dr_Alio 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
U got team viewer? Dont want to fck everything up Carl worked a lot to fix my streamer
Quote from: TiPiRtrolldock

CarlJohnson

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

CarlJohnson

Well to avoid using ZCMD, you can do this.

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

Doc.

Quote from: CarlJohnson on February 12, 2017, 16:25
Well to avoid using ZCMD, you can do this.

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: TiPiRtrolldock

Dr_Alio

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
MISSIONS FAILED
OVERLOADED
FINES PAID
TOTAL SPENT ON FUEL
INTEREST EARNED
DISTANCE TRAVELLED
TIME IN JAIL
LAST MISSION

Doc.

Quote from: Dr_Alio on February 12, 2017, 17:16
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: TiPiRtrolldock

Ethan

Quote from: DOC on February 12, 2017, 17:19
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

Martin

Quote from: Ethan on February 12, 2017, 20:22
Quote from: DOC on February 12, 2017, 17:19
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

Dobby

SA:MP scripting is one of the easiest things to learn. Message me on Steam if you like Ethan.
Quote from: mick88 on May 24, 2015, 21:39
FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK!