Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - habi
1
Off-Topic General / somebody multiple accounts
« on September 15th, 05:07 PM »
this i got from users online

2
Community Plugins / simple announce
« on August 13th, 01:41 PM »
Hi guys, this is what i have been doing for the past couple of hours.

Run your server and just double click announce.exe. It will announce to masterlist.

Just got an interest on how vcmp announce is working.

announce.cpp
Code: [Select]
#define WIN32_LEAN_AND_MEAN
#define _CRT_SECURE_NO_WARNINGS
#include <windows.h>
#include <winsock2.h>
#include <ws2tcpip.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <thread>
// Need to link with Ws2_32.lib, Mswsock.lib, and Advapi32.lib
#pragma comment (lib, "Ws2_32.lib")
#pragma comment (lib, "Mswsock.lib")
#pragma comment (lib, "AdvApi32.lib")

#define DEFAULT_BUFLEN 10240

int __cdecl main(int argc, char** argv)
{
   
    char server_port[6] = "8192";
    if (argc == 2)
    {
        if (strlen(argv[1]) < 4)ZeroMemory(server_port, 6);
        memcpy(server_port, argv[1], strlen(argv[1]));
    }
    const char* PORT = "80";
   
    const char* IP_ADDR = "master.vc-mp.org";

    WSADATA wsaData;
    SOCKET ConnectSocket = INVALID_SOCKET;
    struct addrinfo* result = NULL,
        * ptr = NULL,
        hints;
    char recvbuf[DEFAULT_BUFLEN];
    int iResult;
    int recvbuflen = DEFAULT_BUFLEN;
    // Initialize Winsock
    iResult = WSAStartup(MAKEWORD(2, 2), &wsaData);
    if (iResult != 0) {
        printf("WSAStartup failed with error: %d\n", iResult);
        return 1;
    }

    ZeroMemory(&hints, sizeof(hints));
    hints.ai_family = AF_UNSPEC;
    hints.ai_socktype = SOCK_STREAM;
    //hints.ai_protocol = IPPROTO_UDP;

    // Resolve the server address and port
    iResult = getaddrinfo(IP_ADDR, PORT, &hints, &result);
    if (iResult != 0) {
        printf("getaddrinfo failed with error: %d\n", iResult);
        WSACleanup();
        return 1;
    }

    // Attempt to connect to an address until one succeeds
    for (ptr = result; ptr != NULL; ptr = ptr->ai_next) {

        // Create a SOCKET for connecting to server
        ConnectSocket = socket(ptr->ai_family, ptr->ai_socktype,
            ptr->ai_protocol);
        if (ConnectSocket == INVALID_SOCKET) {
            printf("socket failed with error: %ld\n", WSAGetLastError());
            WSACleanup();
            return 1;
        }

        // Connect to server.
        iResult = connect(ConnectSocket, ptr->ai_addr, (int)ptr->ai_addrlen);
        if (iResult == SOCKET_ERROR) {
            closesocket(ConnectSocket);
            ConnectSocket = INVALID_SOCKET;
            continue;
        }
        break;
    }

    freeaddrinfo(result);

    if (ConnectSocket == INVALID_SOCKET) {
        printf("Unable to connect to server!\n");
        WSACleanup();
        return 1;
    }
    char buf[512];
    sprintf(buf,"POST /announce.php HTTP/1.1\r\n"
        "Host: master.vc-mp.org\r\n"
        "Connection: close\r\n"
        "User-Agent: VCMP/0.4\r\n"
        "VCMP-Version: 0.4\r\n"//VCMP->GetServerVersion();
        "Content-Type: application/x-www-form-urlencoded\r\n"
        "Content-Length: %d\r\n"//strlen of "PORT:8192"
        "\r\n"
        "port=%s",5+strlen(server_port),server_port);
    printf("%s\n", buf);
    // Send an initial buffer
    iResult = send(ConnectSocket, buf, strlen(buf), 0);
    if (iResult == SOCKET_ERROR) {
        printf("send failed with error: %d\n", WSAGetLastError());
        closesocket(ConnectSocket);
        WSACleanup();
        return 1;
    }
    else printf("iResult is %d\n", iResult); int len = 5192;
    char reply[4096];
    iResult = 0;
    iResult = recv(ConnectSocket, reply, len, 0);
    if (iResult > 0)
    {
        printf("iResult is %d\n",iResult);
        reply[iResult] = '\0';
        printf("reply is %s\n", reply);

    }
}


This is mainly made to call from other programs. You have to call regularly. samp calls their announce every 5 minutes. I think VCMP will retain server in masterlist for 15 minutes or so.

The default port is 8192. If there is a change in port, open Command Prompt, go to the directory where this exe lies and type
announce 8194
download
3
Bugs and Crashes / OnPlayerStateChange
« on August 8th, 12:49 PM »
This function is getting called continuously with oldstate=newstate.
4
Community Plugins / Plugin development
« on August 7th, 07:03 AM »
I see that many players have difficulty in plugin development. One of the members asked me how to call a plugin function ( a c++ function inside the plugin) from squirrel.

First of all download a plugin template which has squirrel connected. One you can find in my older post https://forum.vc-mp.org/?topic=7743.0

You might be the first time using C++, never mind. It is so simple. Just google how to install this 'Visual Studio'.

Now when you open the project(.vcxproj), you can see many source files on your right side. Find SQFuncs.cpp. we are going to edit it.

If you open it, into the bottom you can find a function named 'RegisterFuncs'. I think it is created by the LU devs or someone.

Do you know what we are going to do. We are going to create a small function in c++, which can be called from our squirrel. Think of it. In squirrel, we load the plugin from server.cfg and call 'this function' from squirrel. How beautiful?

In some other tutorial i will show how to do the reverse, i.e calling a squirrel function from c++. by squirrel function i mean
Code: [Select]
function abcd(a,b)
{
     print ("a is "+a+ " and b is "+b);
}

It is easy to understand if i tell you we are going to embed this function into plugin.
Say a is a string ie. a "something" and b is an integer ( 100 or something )
We are building a c++ function.
Now search SQFuncs.cpp for 'void RegisterFuncs(HSQUIRRELVM v) '
Just above that function add the following piece of code.
Code: [Select]
_SQUIRRELDEF(SQ_abcd) {
SQInteger n = sq->gettop(v);
if (n == 3) {
const SQChar* a;
sq->getstring(v, 2, &a);
SQInteger b;
sq->getinteger(v, 3, &b);
printf("a is %s and b is %d", a, b);
return 1;
}
return 0;
}
//'void RegisterFuncs(HSQUIRRELVM v) ' begins below
void RegisterFuncs(HSQUIRRELVM v) {

Now let us understand what is what. Don't ask me about 'void RegisterFuncs(HSQUIRRELVM v) ', because it is already there. i mentioned it to specify the location of posting our code.

OKay,
Code: [Select]
_SQUIRRELDEF(SQ_abcd) {
All Squirrel type functions in vcmp plugin begins like this. SQ_abcd is the function name. you can name it as abcd also. (instead of SQ_). No problem. we need the name later.
Code: [Select]
SQInteger n = sq->gettop(v);
Here we are getting the number of arguments passed to our plugin. we will be calling abcd("something",100) from squirrel. However, one extra argument, which i think is called 'root table' also comes. so in our case the number of arguments is not 2, but 3.
we could have used int n instead of SQInteger n. because in c++, everything we do with int. But don't worry. we can use this n the same way as we use int n anywhere. So keep it as SQInteger n.
sq->gettop will return how many arguments are passed( it is called stack and how many members in stack ). In our case we settle it, THREE.
Code: [Select]
if (n == 3) {
const SQChar* a;
We are checking if n is actually three. If somebody called 'abcd("something",100,200)' then n is 4. also n can be 2 if 100 and 200 are avoided.
Now SQChar* a
You know, in c++ strings are handled like 'char* a' and 'const char*a="hello" ' etc. Since we are dealing with squirrel, here it is SQChar* a.
Code: [Select]
sq->getstring(v, 2, &a);
Now get the string and store in our variable 'a'. 2 means the second argument.
first argument is root table, second argument is "something" and third is 100 if we follow the pattern i mentioned above.
Code: [Select]
SQInteger b;
sq->getinteger(v, 3, &b);
I think this is obvious. See here it is 3, because (our second parameter becomes the third parameter here).
What in the world is &b. It is just a symbol used to denote the 'address' of b. Just keep it, no change. it works.
Code: [Select]
printf("a is %s and b is %d", a, b);
return 1;
This is obvious. I think you know about the c++ printf function. it is like our format function in old pawn. (btw i am building a pawn plugin now). s denotes string. d denotes integer.
return 1. this 1 will be returned to squirrel.
ie.abcd("something",200) ==1 in squirrel
tail
Code: [Select]
return 0;
}
In case the function failed, zero is returned.

Now one more step is there.

Go to void RegisterFuncs(HSQUIRRELVM v) {
Inside this function in the end, before function closing bracket add a line.
Code: [Select]
RegisterSquirrelFunc(v, SQ_abcd, "abcd", 0, 0);
This will tell the plugin to make a function named function abcd whose details will be provided by SQ_abcd.
i.e. whenever squirrel calls function abcd, it will redirects to SQ_abcd.
SQ_abcd is what we defined and explained in length above.

Press Ctrl+Shift+B and building starts. Hopefully no error will come. You can see output
Code: [Select]
C:\Users\...\Desktop\...\x64\Release\myplugin.dll
Open the folder and you can find your dll. I think i had set all options in the (.vcxproj) file so it will be simple for you.
(Go to Build->Configuration Manager->Active Solution Platform. Select x64 for 64 bit or x86 for 32 bit)
So we finally compiled a dll ( plugin ) for windows. (compiling a linux plugin is little difficult, i had already made a topic on it)

Now what? open server.cfg and add name of your plugin there.
Then run vcmp server to test. If you have ysc's input plugin you can straight go to console and type abcd();
Console
Code: [Select]
abcd("something",100)
a is something and b is 100

or if you do not have ysc's input plugin,
Code: [Select]
function onScriptLoad()
{
    abcd()

done
5
Tutorials / vehicle.Damage Complete Information
« on August 5th, 06:19 PM »
Hi everybody, i came across setting damage of vehicle and found no articles on it. So i went to vice city, somewhere near Vercetti estate, took a stretch car and started setting vehicle Damage. Here is what i got.

First thing i observed was that Vehicle Damage and Vehicle Health are independent.

1
bumper damaged

2
bumper removed

4
rear bumper (back side) damaged

8
rear bumper lost

16
left door (driver's) damaged

32
Left door opened. So when driving the car, this door will be flying, but still attached. To remove left door completely, use 48=32+16

64
Right door damaged.FRONT. Passenger 1

128
Right door is opened. To remove right door completely use 192

256
Left Back door damaged

512 left back door opened. Use 768 to remove this door completely.

1024 right back door damaged

2048 right back door opened. Use 3072 = 2048+1024 to remove this door completely

4096
damage the part of the car above FRONT right tyre. i dont know what this part is called. here is an image https://imgur.com/T9VXYC2

8192 the above mentioned part is removed completely

16384 now the same part above LEFT FRONT tyre. damaged.

32768 the same part removed completely.

65536 FRONT bonnet partially damaged

131072 bonnet will be flying while car moving( but still attached to vehicle )

To remove the bonnet use 65536+131072=196608

262144 trunk damaged.(also called dicky) BACKSIDE

524288 Flying trunk.

To remove trunk completely use 786432

1048576 Front glass(WINDSHIELD) broken

2097152 WINDSHIELD lost ( i don't know but 3145728 (which i found to be the sum of above two numbers) also is used to indicate that this part is removed completely.

4194304 LEFT front TYRE popped. (flat). sparks

8388608 LEFT front tyre not found/removed completely.

16777216 LEFT BACK tyre popped/flat

33554432 LEFT BACk tyre removed

67108864 RIGHT front TYRE popped and 134217728 for removing it

268435456 RIGHT BACK tyre popped. 536870912 (the largest value) for removing this tyre completely.

This last value is 2 raised to power 29. i tried higher powers, like 30 but no effect.

Now how this values can be combined?
VCMP server has some kind of technology.

eg. There are two doors in the front side. One on left side of driver and other on right side of passenger. To remove left door alone, use vehicle.Damage=48. To remove right door alone, use vehicle.Damage=192. Now to remove both the doors, use vehicle.Damage= 240. How i got 240? by adding 48 and 192.

Exercise. Remove all 4 doors+bonnet+trunk
FindVehicle(137).Damage=48+192+768+3072+196608+786432

This is the VCMP server technology i mentioned, ie. adding numbers.

That's all. I hope this will be useful to everyone.



6
Suppose you want player A to face to player B, you can use
Code: [Select]
FindPlayer(5).Angle=atan2(-(FindPlayer(0).Pos.x-FindPlayer(5).Pos.x),FindPlayer(0).Pos.y-FindPlayer(5).Pos.y)
7
Today, i will show you how to compile your plugin for linux.


You must be having Visual Studio on your computer. Your computer is windows.

You must also have a linux vps.( mine is ubuntu )

What we do is install a thing on vps which will be used for compiling. Then give details of vps to Visual studio ( username: root, password:, and IP address )

Then just click on build on Visual studio. It will copy your project to vps. compile it there and bring back your  output. ( or show a couple of error :D

Detailed Instruction
Step one-> Install Linux Development Workload


2. Create a new Linux Console Application


3. Build. ( it will ask you for details of vps. ip address, username, password. give it )

and

4. You will get error. Go to your vps and install gdb server.
Code: [Select]
sudo apt install -y build-essential gdbserver

Now it will work. The first application will be a helloworld application by default ( has .out extension). You can copy the file to vps and run it by ./ConsoleApplication.out

Now we are building plugin. It has .so extension. So in visual studio, go to solution properties and change .out to .so

You are done.

Now delete ConsoleApplication.cpp and paste our vcmp plugin files, i.e. SQMain.cpp, SQMain.h, SQFuncns.cpp, SQFuncs.h, plugin.h, ConsoleUtils.cpp, ConsoleUtils.h.
copy the files to project directory

add->existing item


Your are successfully completed. Now click build and your plugin.so will be ready.



Credits
https://devblogs.microsoft.com/cppblog/linux-development-with-c-in-visual-studio/

Files( SQMain.cpp, SQFuncs.cpp, etc. )
https://drive.google.com/file/d/1mrIy_vE5l6Y-OOmJ7e8k7cxMXTKkraAx/view?usp=sharing

tags: Remote build
8
General Discussion / killer and player in onPlayerKill
« on June 17th, 03:12 PM »
Actually, the function is onPlayerKill( killer, player, reason, bodypart )

but, in blank server i noticed that the script order is onPlayerKill( player, killer, reason, bodypart ).

It confuses people as well as new bies
( like me two months ago. I was  killing myown client2 minimized, but his kills were increasing)

so seby, take any actions? ;D
9
Scripting and Server Management / about Bytes Stream
« on June 14th, 06:03 AM »
We client script and use stream to pass data. So a quick question.
Especially in blank server, store/main.nut we make something like following,

I used to think how far we can go on numbering. All about the answer flashed to me yesterday, while working with some streams.

I will tell after poll is finished
10
Community Plugins / VCMP helloworld plugin
« on May 12th, 11:52 AM »
If you are looking for VCMP helloworld script, you can find it VCMP Blank Server

This is a template for module making, something little advanced.



It has only one function hello(). When called, it outputs Hello World!

You can download it from here

Just open helloworld.vcxproj file. You will need Visual Studio.

Happy Editing :)
11
Community Plugins / create bots with this plugin
« on May 11th, 01:49 PM »
This is a squirrel plugin to create bots in the server.
Quote
Download plugins

actor32.dll

actor64.dll

Installation  ( very easy )

Copy the actor64.dll into plugins folder. Open server.cfg find the line plugins, add 'actor64' to the last. see pic below



Functions
Only two functions now,
create_actor(name, skinId, x, y, z, angle), set_actor_angle

Examples
Code: [Select]
function onScriptLoad()
{
create_actor( "medic", 5, -656, 756, 11.2, 1.5 );  //5 == ambulance man
create_actor( "emma", 65, -660, 758, 11.2, -1.5 ); 
}

create_actor("john");

create_actor("kevin",5); will spawn a medic with name 'kevin'

create_actor("Edward",1,-656,756,11.2,0); will spawn a cop at downtown facing north.

setport("8193"); ( in case your port is not 8192, but 8193 );

Notes
1. actorid and playerid are different.
2. create_actor returns an integer which is 0 for 1st bot, 1 for 2nd bot and so on. We can call it actor id. 
3. create_actor function will take a little time to create bots.
4. If your server has registration system, you must add the bots name to database. Otherwise the bots cannot spawn.

For detailed documentation, see click Source code below and view readme file.

Note: This project was built with Visual Studio 2019.           Source code


Linux Version

64 bit  actor64.so

32 bit  actor32.so

Source code

Functions are same except set_port. The parameter inside set_port must be integer. eg. set_port( 8193 ). Default is 8192.
12
Tutorials / create_actor
« on April 28th, 09:04 PM »
yeah. finally..

What is it?
creating random actors here and there in server.
here and there?
yes. at any place u want.
how many?
atmost some 40 without lag. i created a seventy five one of them with lag
75 what?
bots/actors.

Tell me the cmd to create it.
it goes like create_actor x y z

Enough. To experienced scripters, i explain what this is. A python program will run  with your server -it is a socket server. you connect a socket to it
Code: [Select]
socket.Send("create_actor 116 lance -661.12 756.365 11.0966 0")
and actor is ready within seconds.

If you have knowledge about packets,
How many packets are send?
one packet per bot in every 2 seconds. it is a ping packet. otherwise it disconnects. Packets are send to the server from python program.

hi guys, i did not know python. for this purpose i learned it.

actor is a word used in vice city script file to the player, cop, pedestrians etc. you might know.
How much time the actor lives?
Until you "destroy_actor id"

So what are the commands you developed?
create_actor skinID name x y z angle
set_actor_pos id x y z
set_actor_health id 100
for the first actor you create, id will be 1, then 2, then 3, and so on.

Any other? Two more commands are there, which i developed by evening.
set_actor_weapon id 22
set_actor_angle id 3.14


codes here->https://github.com/habi498/create_actor
Also, i recommend you to use cmdinputrel by ysc, to have easy interaction with bots.
13
General Discussion / wiki down for two months
« on April 21st, 01:36 PM »
the vcmp wiki is down for a long time. I wish contribute to wiki, about vehicle.Angle and vehicle.Rotation, etc
14
Tutorials / half bots
« on April 16th, 02:59 PM »
Today i will show how to have a kind of bots in your server.

First you go to server and 'record' actions for say 5 minutes. I will tell how to 'record'.
Then you play it. the same things happen in server.

1. You need wireshark https://www.wireshark.org/#download
2. You need python ( mine is not 3 , it is 2.x )
3. Scapy https://scapy.readthedocs.io/en/latest/installation.html

You are going to connect to a server ( do not connect to 127.0.0.1:8192 but something else )
Now, open wireshark and select interface ( mine is Wi-Fi )
Then it will start recording packets. All you need is open VCMP Browser. Select your server play on it for some time.
Then come back to wireshark and stop. Then save the packets in *.pcap extension. eg. play.pcap

Now you can play it in two ways. 1. Colasoft Packet Player https://www.colasoft.com/packet_player/ which is the software i started with. But you do not need it, since i made a python code to manually play the packets. So here 2. Using python and scapy to play it. Edit the python file below and change ip address, name, etc. Place your pcap file and python file in same folder and run the python file. You will see a new player appearing in your server.

Code: [Select]
#!/usr/bin/env python3
# importing the threading module
import threading
from scapy.all import *
from scapy.utils import rdpcap
import time
import sys

if __name__ == "__main__":
   
    name = "hh17"# 4 letter   
    old_name = "habi"
    a=rdpcap("second.pcap")
    i=0;
    for b in a:
        m=0;
        if hasattr(b, 'load'):
                if b.load.find(bytes(old_name.encode())) >=0:
                    b.load=b.load.replace(bytes(old_name.encode()),bytes(name.encode()))       
        if(UDP in b):
            del b[UDP].chksum
            del b[UDP].len
        if(Ether in b and IP in b and UDP in b):
            send(IP(dst="127.0.0.1")/b[UDP], verbose=True,iface='Npcap Loopback Adapter');
        if(i<len(a)-1):
            m= float( a[i+1].time - a[i].time );
        time.sleep(m);
        i=i+1;
15
Script Showroom / cheatcodes
« on April 13th, 12:05 PM »
CHEATCODES
hey guys, you might not like this but any way. here is a snippet for using cheatcodes in game.

below is script for client and server
(click to show/hide)
Clientside
1. cheat_keybinds.nut
Code: [Select]
Console.Print("Key bindings starting...");
A<-KeyBind(0x41);
B<-KeyBind(0x42);
C<-KeyBind(0x43);
D<-KeyBind(0x44);
E<-KeyBind(0x45);
F<-KeyBind(0x46);
G<-KeyBind(0x47);
H<-KeyBind(0x48);
I<-KeyBind(0x49);
J<-KeyBind(0x4A);
K<-KeyBind(0x4B);
L<-KeyBind(0x4C);
M<-KeyBind(0x4D);
N<-KeyBind(0x4E);
O<-KeyBind(0x4F);
P<-KeyBind(0x50);
Q<-KeyBind(0x51);
R<-KeyBind(0x52);
S<-KeyBind(0x53);
T<-KeyBind(0x54);
U<-KeyBind(0x55);
V<-KeyBind(0x56);
W<-KeyBind(0x57);
X<-KeyBind(0x58);
Y<-KeyBind(0x59);
Z<-KeyBind(0x5A);
Console.Print("Key bindings done");
Console.Print("Now hooking function");
function GetLetter( key )
{
switch( key )
{
case A : return "A" ;
case B : return "B" ;
case C : return "C" ;
case D : return "D" ;
case E : return "E" ;
case F : return "F" ;
case G : return "G" ;
case H : return "H" ;
case I : return "I" ;
case J : return "J" ;
case K : return "K" ;
case L : return "L" ;
case M : return "M" ;
case N : return "N" ;
case O : return "O" ;
case P : return "P" ;
case Q : return "Q" ;
case R : return "R" ;
case S : return "S" ;
case T : return "T" ;
case U : return "U" ;
case V : return "V" ;
case W : return "W" ;
case X : return "X" ;
case Y : return "Y" ;
case Z : return "Z" ;
default: return null;
}
}
Console.Print("done.");

2. cheat.nut
Code: [Select]
dofile("cheat_keybinds.nut");
cheats<-{
codes=["ASPIRINE","PANZER","PRECIOUSPROTECTION","NUTTERTOOLS","PROFESSIONALTOOLS",
"THUGSTOOLS","LEAVEMEALONE","TRAVELINSTYLE","GETTHEREQUICKLY","ALOVELYDAY",
"CATSANDDOGS","APLEASANTDAY","SEAWAYS","COMEFLYWITHME","ICANTTAKEITANYMORE",
"THELASTRIDE","ROCKANDROLLCAR","BETTERTHANWALKING","GETTHEREFAST","RUBBISHCAR",
"GRIPISEVERYTHING","LOOKLIKELANCE","MYSONISALAWYER","LOOKLIKEHILARY",
"ROCKANDROLLMAN","WELOVEOURDICK","ONEARMEDBANDIT","IDONTHAVETHEMONEYSONNY","FOXYLITTLETHING",
"CANTSEEATHING","ABITDRIEG","LIFEISPASSINGMEBY","BOOOOOORING","LEAVEMEALONE",
"YOUWONTTAKEMEALIVE","CHEATSHAVEBEENCRACKED","GETTHEREVERYFASTINDEED","GETTHEREAMAZINGLYFAST",
"AHAIRDRESSERSCAR","BIGBANG"],
clear=function(){this.content=""},
get=function(){
foreach( cheat in this.codes )
{
if( this.content.find( cheat ) != null )
{
return cheat;
}
}
},
getindex=function( cheat ){
return this.codes.find( cheat );
},
lastcall=Script.GetTicks(),content=""
};


function onTyped( key )
{
local currentCall=Script.GetTicks();
if( currentCall - ::cheats.lastcall > 3000 )
{
::cheats.clear();
}

local letter = GetLetter( key );
if( letter )
{
::cheats.content+=letter;
local cheat_code = cheats.get();
if( cheat_code )
{
SendDataToServer( StreamType.CHEATCODE, cheats.getindex(cheat_code) );
::cheats.clear();
}
}

::cheats.lastcall=currentCall;
}

3. main.nut
Code: [Select]
enum StreamType
{ CHEATCODE=0x18
}
dofile("cheat.nut");
function KeyBind::OnDown( key )
{
onTyped( key );
}

Server side
1.cheatcode.nut
Code: [Select]
cheat_vehicles<-[];cheat_activated<-false;
codes<-["ASPIRINE","PANZER","PRECIOUSPROTECTION","NUTTERTOOLS","PROFESSIONALTOOLS",
"THUGSTOOLS","LEAVEMEALONE","TRAVELINSTYLE","GETTHEREQUICKLY","ALOVELYDAY",
"CATSANDDOGS","APLEASANTDAY","SEAWAYS","COMEFLYWITHME","ICANTTAKEITANYMORE",
"THELASTRIDE","ROCKANDROLLCAR","BETTERTHANWALKING","GETTHEREFAST","RUBBISHCAR",
"GRIPISEVERYTHING","LOOKLIKELANCE","MYSONISALAWYER","LOOKLIKEHILARY",
"ROCKANDROLLMAN","WELOVEOURDICK","ONEARMEDBANDIT","IDONTHAVETHEMONEYSONNY","FOXYLITTLETHING",
"CANTSEEATHING","ABITDRIEG","LIFEISPASSINGMEBY","BOOOOOORING","LEAVEMEALONE",
"YOUWONTTAKEMEALIVE","CHEATSHAVEBEENCRACKED","GETTHEREVERYFASTINDEED","GETTHEREAMAZINGLYFAST",
"AHAIRDRESSERSCAR","BIGBANG"];
function onCheatCode( player, cheat_code_index )
{
local cheat_code = codes[cheat_code_index];
switch( cheat_code )
{
case "PANZER":
{
local panzer = CreateVehicle( 162 ,player.Pos+Vector(5,5,7 ),player.Angle,46,2);
cheat_vehicles.push( panzer.ID );
panzer.Immunity=127;cheat_activated=true;
}
break;
case "NUTTERTOOLS":
{
player.SetWeapon( 29, 21 );
player.SetWeapon( 29, 21 );
player.SetWeapon( 33, 500 );
player.SetWeapon( 26, 150 );
player.SetWeapon( 25, 100 );
player.SetWeapon( 20, 30 );
player.SetWeapon( 18, 40 );
player.SetWeapon( 12, 10 );
player.SetWeapon( 11, 1 );
Announce("Weapon cheat",player,0);
}
break;
case "PROFESSIONALTOOLS":
{

player.SetWeapon( 29, 21 );
player.SetWeapon( 30, 5 );
player.SetWeapon( 26, 150 );
player.SetWeapon( 24, 100 );
player.SetWeapon( 21, 25 );
player.SetWeapon( 18, 40 );
player.SetWeapon( 13, 10 );
player.SetWeapon( 10, 1 );
Announce("Weapon cheat",player,0);
}
break;
case "THUGSTOOLS":
{
player.SetWeapon( 28, 25 );
player.SetWeapon( 31, 20 );
player.SetWeapon( 27, 240 );
player.SetWeapon( 22, 300 );
player.SetWeapon( 19, 75 );
player.SetWeapon( 17, 100 );
player.SetWeapon( 15, 10 );
player.SetWeapon( 6, 1 );
player.SetWeapon( 1, 1 );
Announce("Weapon cheat",player,0);
}
break;
case "ASPIRINE":
{
player.Health = 100;
Announce("Health cheat",player,0);
}break;
case "PRECIOUSPROTECTION":
{
player.Armour = 100;
Announce("Armor cheat",player,0);
}
break;
case "TRAVELINSTYLE":
{
local vehicle = CreateVehicle( 234 ,player.Pos+Vector(5,5,7 ),player.Angle,rand()%94,rand()%94);
cheat_vehicles.push( vehicle.ID );cheat_activated=true;
Announce("Cheat activated",player,0);
}
break;
case "GETTHEREQUICKLY":
{
local vehicle = CreateVehicle( 235 ,player.Pos+Vector(5,5,7 ),player.Angle,rand()%94,rand()%94);
cheat_vehicles.push( vehicle.ID );cheat_activated=true;
Announce("Cheat activated",player,0);
}
break;
case "THELASTRIDE":
{
local vehicle = CreateVehicle( 172 ,player.Pos+Vector(5,5,7 ),player.Angle,rand()%94,rand()%94);
cheat_vehicles.push( vehicle.ID );cheat_activated=true;
Announce("Cheat activated",player,0);
}break;
case "ROCKANDROLLCAR":
{
local vehicle = CreateVehicle( 201 ,player.Pos+Vector(5,5,7 ),player.Angle,rand()%94,rand()%94);
cheat_vehicles.push( vehicle.ID );cheat_activated=true;
Announce("Cheat activated",player,0);
}break;
case "BETTERTHANWALKING":
{
local vehicle = CreateVehicle( 187 ,player.Pos+Vector(5,5,7 ),player.Angle,rand()%94,rand()%94);
cheat_vehicles.push( vehicle.ID );cheat_activated=true;
Announce("Cheat activated",player,0);
}break;
case "GETTHEREFAST":
{
local vehicle = CreateVehicle( 206 ,player.Pos+Vector(5,5,7 ),player.Angle,rand()%94,rand()%94);
cheat_vehicles.push( vehicle.ID );cheat_activated=true;
Announce("Cheat activated",player,0);
}break;
case "GETTHEREVERYFASTINDEED":
{
local vehicle = CreateVehicle( 232 ,player.Pos+Vector(5,5,7 ),player.Angle,rand()%94,rand()%94);
cheat_vehicles.push( vehicle.ID );cheat_activated=true;
Announce("Cheat activated",player,0);
}break;
case "GETTHEREAMAZINGLYFAST":
{
local vehicle = CreateVehicle( 233,player.Pos+Vector(5,5,7 ),player.Angle,rand()%94,rand()%94);
cheat_vehicles.push( vehicle.ID );cheat_activated=true;
Announce("Cheat activated",player,0);
}break;
case "RUBBISHCAR":
{
local vehicle = CreateVehicle( 138 ,player.Pos+Vector(5,5,7 ),player.Angle,rand()%94,rand()%94);
cheat_vehicles.push( vehicle.ID );cheat_activated=true;
Announce("Cheat activated",player,0);
}break;
case "GRIPISEVERYTHING":
{
SetPerfectHandling( true ); cheat_activated=true;
Announce("Cheat activated",player,0);
}break;
case "CATSANDDOGS":
{
SetWeather(2);cheat_activated=true;
AnnounceAll("Weather cheat",0);
}
break;
case "APLEASANTDAY":
{
SetWeather(0);
AnnounceAll("Weather cheat",0);
}
break;
case "ALOVELYDAY":
{
SetWeather(4);
AnnounceAll("Weather cheat",0);
}
break;
case "CANTSEEATHING":
{
SetWeather(3);
AnnounceAll("Weather cheat",0);
}
break;
case "ABITDRIEG":
{
SetWeather(1);
AnnounceAll("Weather cheat",0);
}
break;
case "LIFEISPASSINGMEBY":
{
SetTimeRate(80);cheat_activated=true;
AnnounceAll("Weather cheat",0);
}
break;
case "SEAWAYS":
{
SetDriveOnWater( true );cheat_activated=true;
Announce("Cheat activated",player,0);
}
break;
case "COMEFLYWITHME":
{
SetFlyingCars( true );cheat_activated=true;
Announce("Cheat activated",player,0);
}
break;
case "BOOOOOORING":
{
SetGamespeed( 0.32 );cheat_activated=true;
Announce("Cheat activated",player,0);
}
break;
case "ICANTTAKEITANYMORE":
{
player.Health = 0;
Announce("Cheat activated",player,0);
}
break;
case "LEAVEMEALONE":
{
player.SetWantedLevel( 0 );
Announce("Wanted level cheat",player,0);
}
break;
case "YOUWONTTAKEMEALIVE":
{
local s = player.WantedLevel;
local w= (s==6||s==5)?6:s<5 && s>=0?s+2:2;
player.SetWantedLevel( w );
Announce("Wanted level cheat",player,0);
}
break;
case "LOOKLIKELANCE":player.Skin=116; break;
case "MYSONISALAWYER":player.Skin=109; break;
case "LOOKLIKEHILARY":player.Skin=111; break;
case "ROCKANDROLLMAN":player.Skin=108; break;
case "WELOVEOURDICK":player.Skin=118; break;
case "ONEARMEDBANDIT":player.Skin=113; break;
case "IDONTHAVETHEMONEYSONNY":player.Skin=115; break;
case "FOXYLITTLETHING":player.Skin=117; break;
case "CHEATSHAVEBEENCRACKED":player.Skin=107;break;
case "AHAIRDRESSERSCAR":Pink(); AnnounceAll("Cheat activated",0);break;
case "BIGBANG":bigbang(); AnnounceAll("Cheat activated",0);break;
default:
break;
}
}


function cheatReset()
{
if( cheat_activated == false ) return;
SetDriveOnWater( false );
SetFlyingCars( false );
SetWeather(0);
SetPerfectHandling( false );
SetTimeRate( 1000 );
SetGamespeed(1);
local veh
foreach( id in cheat_vehicles )
{
veh = FindVehicle( id );
if( veh )veh.Delete();
cheat_vehicles.remove( id );
}
}
function bigbang()
{
local i,veh,model;
for( i = 1; i <= GetVehicleCount(); i++ )
{
veh = FindVehicle( i );
if( veh )
{
veh.Kill();
}
}
}
function Pink()
{
local i,veh,model;
for( i = 1; i <= GetVehicleCount(); i++ )
{
veh = FindVehicle( i );
if( veh )
{
model = veh.Model;
if( !O(model,146,137,150,156,157,158,163,168,178,188,200,216) )
{
veh.Colour1=5;
veh.Colour2=0;
}
}
}
}
function O(t,...)
{
foreach(val in vargv)
{
if(t==val)return 1;
}
return 0;
}

2. main.nut
Code: [Select]
enum StreamType
{
CHEATCODE=0x18
}
function onScriptLoad()
{
    dofile("scripts/cheatcode.nut");
}
function onClientScriptData( player )
{
    // receiving client data
    local stream = Stream.ReadByte();
    switch ( stream )
    {
case StreamType.CHEATCODE:
{
onCheatCode( player, Stream.ReadInt());
}
break;
default:
break;

    }
}


A screenshot
(click to show/hide)

You just need to type the cheat codes. ASPIRINE, PRECIOUSPROTECTION, *adding bigbang* and that is all.
you can type the codes even in the 'menu' ( esc key )
Good luck!