IIV NATHAN VII
You never know for sure unless you try
Hopefully these will help you guys advance or something I dunno.. may as-well help the community somehow though so here goes.
You may get some native errors when using some of my sources, if so; add/replace the original natives with these:
If you're looking for a function in one of my sources, find it in the spoiler below.
You may get some native errors when using some of my sources, if so; add/replace the original natives with these:
C:
extern int NETWORK_GET_FRIEND_COUNT(void);
extern char* NETWORK_GET_FRIEND_NAME(int id);
extern bool NETWORK_IS_FRIEND_ONLINE(char* friendsGamerTag);
extern bool NETWORK_IS_FRIEND_IN_SAME_TITLE(char* friendsGamerTag);
extern void NETWORK_SHOW_FRIEND_PROFILE_UI(char* friendsGamerTag);
This is simply to a quick number to string from 0-100, releasing this for convenience more than anything as some things are broke with scocl..
Example usage: print(numberTOstring[number from 0-100]);
C:
char* numberTOstring(int number)
{
if(number > 100) return "100+";
else if(number < 0) return "0-";
char* numTOstring[101];
numTOstring[0] = "0";
numTOstring[1] = "1";
numTOstring[2] = "2";
numTOstring[3] = "3";
numTOstring[4] = "4";
numTOstring[5] = "5";
numTOstring[6] = "6";
numTOstring[7] = "7";
numTOstring[8] = "8";
numTOstring[9] = "9";
numTOstring[10] = "10";
numTOstring[11] = "11";
numTOstring[12] = "12";
numTOstring[13] = "13";
numTOstring[14] = "14";
numTOstring[15] = "15";
numTOstring[16] = "16";
numTOstring[17] = "17";
numTOstring[18] = "18";
numTOstring[19] = "19";
numTOstring[20] = "20";
numTOstring[21] = "21";
numTOstring[22] = "22";
numTOstring[23] = "23";
numTOstring[24] = "24";
numTOstring[25] = "25";
numTOstring[26] = "26";
numTOstring[27] = "27";
numTOstring[28] = "28";
numTOstring[29] = "29";
numTOstring[30] = "30";
numTOstring[31] = "31";
numTOstring[32] = "32";
numTOstring[33] = "33";
numTOstring[34] = "34";
numTOstring[35] = "35";
numTOstring[36] = "36";
numTOstring[37] = "37";
numTOstring[38] = "38";
numTOstring[39] = "39";
numTOstring[40] = "40";
numTOstring[41] = "41";
numTOstring[42] = "42";
numTOstring[43] = "43";
numTOstring[44] = "44";
numTOstring[45] = "45";
numTOstring[46] = "46";
numTOstring[47] = "47";
numTOstring[48] = "48";
numTOstring[49] = "49";
numTOstring[50] = "50";
numTOstring[51] = "51";
numTOstring[52] = "52";
numTOstring[53] = "53";
numTOstring[54] = "54";
numTOstring[55] = "55";
numTOstring[56] = "56";
numTOstring[57] = "57";
numTOstring[58] = "58";
numTOstring[59] = "59";
numTOstring[60] = "60";
numTOstring[61] = "61";
numTOstring[62] = "62";
numTOstring[63] = "63";
numTOstring[64] = "64";
numTOstring[65] = "65";
numTOstring[66] = "66";
numTOstring[67] = "67";
numTOstring[68] = "68";
numTOstring[69] = "69";
numTOstring[70] = "70";
numTOstring[71] = "71";
numTOstring[72] = "72";
numTOstring[73] = "73";
numTOstring[74] = "74";
numTOstring[75] = "75";
numTOstring[76] = "76";
numTOstring[77] = "77";
numTOstring[78] = "78";
numTOstring[79] = "79";
numTOstring[80] = "80";
numTOstring[81] = "81";
numTOstring[82] = "82";
numTOstring[83] = "83";
numTOstring[84] = "84";
numTOstring[85] = "85";
numTOstring[86] = "86";
numTOstring[87] = "87";
numTOstring[88] = "88";
numTOstring[89] = "89";
numTOstring[90] = "90";
numTOstring[91] = "91";
numTOstring[92] = "92";
numTOstring[93] = "93";
numTOstring[94] = "94";
numTOstring[95] = "95";
numTOstring[96] = "96";
numTOstring[97] = "97";
numTOstring[98] = "98";
numTOstring[99] = "99";
numTOstring[100] = "100";
return numTOstring[number];
}
If you're looking for a function in one of my sources, find it in the spoiler below.
These are some functions that can make it easier to code, sometimes reduce file size and make coding lazier.
For this one you may get an error when compiling, if this happens remove the extern bool IS_THIS_PED_A_PLAYER(Ped blah); in your natives.h as it doesn't work.
C:
void nathan_clear_objects_on_car(Vehicle veh){
if(!DOES_VEHICLE_EXIST(veh)) return;
int i,delObj,nvid;
for(i=16;i<=9999;i++){
if(!DOES_OBJECT_EXIST_WITH_NETWORK_ID(i)) continue;
GET_OBJECT_FROM_NETWORK_ID(i,&delObj);
if(!IS_OBJECT_ATTACHED(delObj)) continue;
if(!DOES_VEHICLE_EXIST(veh)) return;
if(GET_CAR_OBJECT_IS_ATTACHED_TO(delObj) != veh) continue;
GET_NETWORK_ID_FROM_OBJECT(delObj,&nvid);
if(!network_control(nvid)) continue;
DELETE_OBJECT(&delObj);
}
}
C:
void print_two(char* text,char* text2){
//CLEAR_PRINTS();
ADD_NEXT_MESSAGE_TO_PREVIOUS_BRIEFS(false);
PRINT_STRING_WITH_TWO_LITERAL_STRINGS_NOW("STRTNM3", text, text2, 5000, 1);
}
C:
bool is_driving(Ped tmp_char)
{
int tmp_veh,tmp_driver = 99;
if(IS_CHAR_IN_ANY_CAR(tmp_char))
{
GET_CAR_CHAR_IS_USING(tmp_char,&tmp_veh);
GET_DRIVER_OF_CAR(tmp_veh,&tmp_driver);
}
return (tmp_driver == tmp_char);
}
C:
void GET_CAR_PASSENGERS(int car, int *Passenger1, int *Passenger2, int *Passenger3)
{
GET_CHAR_IN_CAR_PASSENGER_SEAT(car,0,&*Passenger1);
GET_CHAR_IN_CAR_PASSENGER_SEAT(car,1,&*Passenger2);
GET_CHAR_IN_CAR_PASSENGER_SEAT(car,2,&*Passenger3);
return;
}
C:
Vehicle GetPlayerVeh(void)
{
Vehicle vehicle = INVALID_HANDLE;
if(IS_CHAR_IN_ANY_CAR(GetPlayerPed()))
GET_CAR_CHAR_IS_USING(GetPlayerPed(), &vehicle);
return vehicle;
}
C:
bool IS_THIS_PED_A_PLAYER(Ped query_ped)
{
if(!IS_NETWORK_SESSION()) return false;
int i,tmp_ped;
for(i=0;i<GET_NUMBER_OF_PLAYERS();i++)
{
if(!IS_NETWORK_PLAYER_ACTIVE(i)) continue;
GET_PLAYER_CHAR(i,&tmp_ped);
if(tmp_ped == query_ped) return true;
}
return false;
}
This is simply a shuffle seats I made specifically to work with motorcycles.
C:
void Nathan_Shuffle_Seats(void)
{
if(IS_CHAR_ON_ANY_BIKE(GetPlayerPed()))
{
GET_DRIVER_OF_CAR(GetPlayerVeh(),&driver);
if(!DOES_CHAR_EXIST(driver))
WARP_CHAR_INTO_CAR(GetPlayerPed(),GetPlayerVeh());
else if(driver == GetPlayerPed() && IS_CAR_PASSENGER_SEAT_FREE(GetPlayerVeh(),0))
WARP_CHAR_INTO_CAR_AS_PASSENGER(GetPlayerPed(),GetPlayerVeh(),0);
return;
}
TASK_SHUFFLE_TO_NEXT_CAR_SEAT(GetPlayerPed(),GetPlayerVeh());
return;
}
C:
void Nathans_Group_Protection(void)
{
//Note I use GetPlayerPed(), as some older protections tend to flip your char, so pPlayer (or a ped stored in a var) may become outdated and cause a freeze.
Group localgroup;
GET_PLAYER_GROUP(GET_PLAYER_ID(),&localgroup);
//You can remove the DOES_GROUP_EXIST check below, but you'll get a false group hack warning on startup if you do..
if(DOES_GROUP_EXIST(localgroup) && !IS_GROUP_LEADER(GetPlayerPed(),localgroup))
{
bool fixed; //bools are false by default.
for(i=0;i<NETWORK_GET_MAX_SLOTS();i++)
{
if(!IS_NETWORK_PLAYER_ACTIVE(i) || GET_PLAYER_ID() == i) continue;
GET_PLAYER_CHAR(i,&tmp_ped);
if(!DOES_CHAR_EXIST(tmp_ped)) continue;
if(!IS_PED_IN_GROUP(tmp_ped)) continue;
REMOVE_CHAR_FROM_GROUP(GetPlayerPed());
GET_PLAYER_GROUP(GET_PLAYER_ID(),&localgroup);
if(DOES_GROUP_EXIST(localgroup))
SET_GROUP_LEADER(localgroup,GetPlayerPed());
else
CREATE_GROUP(0,localgroup,true);
if(IS_THIS_MACHINE_THE_SERVER())
{
Alert_Two("~r~Group Hack: ~c~The following player was kicked for interfering with your group",GET_PLAYER_NAME(i));
NETWORK_KICK_PLAYER(i,true);
}
else
Alert_Two("~r~Group Hack: ~c~The following player tried changing your group",GET_PLAYER_NAME(i));
fixed = true;
break;
}
//The following code is to protect against a network ghost attacker or someone using another exploit.
if(!fixed)
{
REMOVE_CHAR_FROM_GROUP(GetPlayerPed());
GET_PLAYER_GROUP(GET_PLAYER_ID(),&localgroup);
if(DOES_GROUP_EXIST(localgroup))
SET_GROUP_LEADER(localgroup,GetPlayerPed());
else
CREATE_GROUP(0,localgroup,true);
Alert("~r~Group Hack: ~c~Someone tried to change your group and is likely trying to freeze you!");
}
}
}
C:
void Nathans_Change_Player(uint modelp)
{
if(!IS_MODEL_IN_CDIMAGE(modelp))
{
print("~BLIP_76~ ~r~Model is missing from your ISO, or not present in this episode.");
return;
}
REQUEST_MODEL(modelp);
int current_wep;
bool has_mp5 = HAS_CHAR_GOT_WEAPON(pPlayer,WEAPON_MP5);
bool has_glock = HAS_CHAR_GOT_WEAPON(pPlayer,WEAPON_PISTOL);
bool has_knife = HAS_CHAR_GOT_WEAPON(pPlayer,WEAPON_KNIFE);
bool has_sniperrifle = HAS_CHAR_GOT_WEAPON(pPlayer,WEAPON_SNIPERRIFLE);
bool has_baretta = HAS_CHAR_GOT_WEAPON(pPlayer,WEAPON_BARETTA);
bool has_deagle = HAS_CHAR_GOT_WEAPON(pPlayer,WEAPON_DEAGLE);
bool has_bazooka = HAS_CHAR_GOT_WEAPON(pPlayer,WEAPON_RLAUNCHER);
bool has_grenade = HAS_CHAR_GOT_WEAPON(pPlayer,WEAPON_GRENADE);
bool has_m4 = HAS_CHAR_GOT_WEAPON(pPlayer,WEAPON_M4);
bool has_molotov = HAS_CHAR_GOT_WEAPON(pPlayer,WEAPON_MOLOTOV);
bool has_uzi = HAS_CHAR_GOT_WEAPON(pPlayer,WEAPON_MICRO_UZI);
bool has_ak47 = HAS_CHAR_GOT_WEAPON(pPlayer,WEAPON_AK47);
bool has_shotgun = HAS_CHAR_GOT_WEAPON(pPlayer,WEAPON_SHOTGUN);
bool has_M40A1 = HAS_CHAR_GOT_WEAPON(pPlayer,WEAPON_M40A1);
//TBOGT
bool has_1 = HAS_CHAR_GOT_WEAPON(pPlayer,WEAPON_EPISODIC_1);
bool has_9 = HAS_CHAR_GOT_WEAPON(pPlayer,WEAPON_EPISODIC_9);
bool has_10 = HAS_CHAR_GOT_WEAPON(pPlayer,WEAPON_EPISODIC_10);
bool has_12 = HAS_CHAR_GOT_WEAPON(pPlayer,WEAPON_EPISODIC_12);
bool has_13 = HAS_CHAR_GOT_WEAPON(pPlayer,WEAPON_EPISODIC_13);
bool has_14 = HAS_CHAR_GOT_WEAPON(pPlayer,WEAPON_EPISODIC_14);
bool has_15 = HAS_CHAR_GOT_WEAPON(pPlayer,WEAPON_EPISODIC_15);
bool has_16 = HAS_CHAR_GOT_WEAPON(pPlayer,WEAPON_EPISODIC_16);
bool has_21 = HAS_CHAR_GOT_WEAPON(pPlayer,WEAPON_EPISODIC_21);
GET_CURRENT_CHAR_WEAPON(pPlayer,¤t_wep);
int car;
bool in_car, driving;
if(IS_CHAR_IN_ANY_CAR(pPlayer))
{
in_car = true;
GET_CAR_CHAR_IS_USING(pPlayer,&car);
int driver;
GET_DRIVER_OF_CAR(car,&driver);
driving = (driver == pPlayer);
}
float h;
GET_CHAR_HEADING(pPlayer,&h);
int room_key,armour;
GET_CHAR_ARMOUR(pPlayer,&armour);
if(IS_INTERIOR_SCENE())
GET_KEY_FOR_CHAR_IN_ROOM(pPlayer, &room_key);
while (!HAS_MODEL_LOADED(modelp)) WAIT(0);
CHANGE_PLAYER_MODEL(GET_PLAYER_ID(), modelp);
MARK_MODEL_AS_NO_LONGER_NEEDED(modelp);
pPlayer = GetPlayerPed(); //don't remove this... your char changes when your model does..
SET_CHAR_HEADING(pPlayer,h);
if(has_mp5) GIVE_WEAPON_TO_CHAR(pPlayer,WEAPON_MP5,AMMO_MAX,false);
if(has_glock) GIVE_WEAPON_TO_CHAR(pPlayer,WEAPON_PISTOL,AMMO_MAX,false);
if(has_knife) GIVE_WEAPON_TO_CHAR(pPlayer,WEAPON_KNIFE,1,false);
if(has_sniperrifle) GIVE_WEAPON_TO_CHAR(pPlayer,WEAPON_SNIPERRIFLE,AMMO_MAX,false);
if(has_baretta) GIVE_WEAPON_TO_CHAR(pPlayer,WEAPON_BARETTA,AMMO_MAX,false);
if(has_deagle) GIVE_WEAPON_TO_CHAR(pPlayer,WEAPON_DEAGLE,AMMO_MAX,false);
if(has_bazooka) GIVE_WEAPON_TO_CHAR(pPlayer,WEAPON_RLAUNCHER,AMMO_MAX,false);
if(has_grenade) GIVE_WEAPON_TO_CHAR(pPlayer,WEAPON_GRENADE,AMMO_MAX,false);
if(has_m4) GIVE_WEAPON_TO_CHAR(pPlayer,WEAPON_M4,AMMO_MAX,false);
if(has_molotov) GIVE_WEAPON_TO_CHAR(pPlayer,WEAPON_MOLOTOV,AMMO_MAX,false);
if(has_uzi) GIVE_WEAPON_TO_CHAR(pPlayer,WEAPON_MICRO_UZI,AMMO_MAX,false);
if(has_ak47) GIVE_WEAPON_TO_CHAR(pPlayer,WEAPON_AK47,AMMO_MAX,false);
if(has_shotgun) GIVE_WEAPON_TO_CHAR(pPlayer,WEAPON_SHOTGUN,AMMO_MAX,false);
if(has_M40A1) GIVE_WEAPON_TO_CHAR(pPlayer,WEAPON_M40A1,AMMO_MAX,false);
//TBOGT
if(has_1) GIVE_WEAPON_TO_CHAR(pPlayer,WEAPON_EPISODIC_1,AMMO_MAX,false);
if(has_9) GIVE_WEAPON_TO_CHAR(pPlayer,WEAPON_EPISODIC_9,AMMO_MAX,false);
if(has_10) GIVE_WEAPON_TO_CHAR(pPlayer,WEAPON_EPISODIC_10,AMMO_MAX,false);
if(has_12) GIVE_WEAPON_TO_CHAR(pPlayer,WEAPON_EPISODIC_12,AMMO_MAX,false);
if(has_13) GIVE_WEAPON_TO_CHAR(pPlayer,WEAPON_EPISODIC_13,AMMO_MAX,false);
if(has_14) GIVE_WEAPON_TO_CHAR(pPlayer,WEAPON_EPISODIC_14,AMMO_MAX,false);
if(has_15) GIVE_WEAPON_TO_CHAR(pPlayer,WEAPON_EPISODIC_15,AMMO_MAX,false);
if(has_16) GIVE_WEAPON_TO_CHAR(pPlayer,WEAPON_EPISODIC_16,AMMO_MAX,false);
if(has_21) GIVE_WEAPON_TO_CHAR(pPlayer,WEAPON_EPISODIC_21,AMMO_MAX,false);
SET_CURRENT_CHAR_WEAPON(pPlayer,current_wep,true);
if(armour > 0)
{
GIVE_WEAPON_TO_CHAR(pPlayer,WEAPON_ARMOUR,1,false);
ADD_ARMOUR_TO_CHAR(pPlayer,armour);
}
if(driving)
WARP_CHAR_INTO_CAR(pPlayer,car);
else if(in_car)
{
int i;
for(i=0;i<3;i++)
{
if(IS_CAR_PASSENGER_SEAT_FREE(car,i))
WARP_CHAR_INTO_CAR_AS_PASSENGER(pPlayer,car,i);
}
}
if(IS_INTERIOR_SCENE())
SET_ROOM_FOR_CHAR_BY_KEY(pPlayer, room_key);
}
The following simply speeds up the time, but it had a surprisingly good response from the public so the following is the code behind the "Cycle Time" feature that can be found in Extend.
C:
int hour,minute;
GET_TIME_OF_DAY(&hour,&minute);
if(minute == 59 && hour != 23)
{
hour++; //set hour to increase
minute = 0; //set minute to 0
}
if(hour <=23 && minute <=58) minute++;
if(hour == 23 && minute == 59)
{
hour = 0;
minute = 0;
}
SET_TIME_OF_DAY(hour,minute);
C:
void nathan_delete_vehicles(int desired_distance,bool abandoned_only,char* type){
int mode;
if(COMPARE_STRING(type,"all")) mode = 1;
else if(COMPARE_STRING(type,"cars")) mode = 2;
else if(COMPARE_STRING(type,"boats")) mode = 3;
else if(COMPARE_STRING(type,"helis")) mode = 4;
else if(COMPARE_STRING(type,"bikes")) mode = 5;
int i,vehicle;
float distance,x,y,z,mx,my,mz;
Ped driver;
int model;
GET_CHAR_COORDINATES(pPlayer,&mx,&my,&mz);
int DelObj;
for(DelObj = 0;DelObj < 9;DelObj++){
for(i=0;i<5001;i++){
if(!DOES_VEHICLE_EXIST_WITH_NETWORK_ID(i)) continue;
GET_VEHICLE_FROM_NETWORK_ID(i,&vehicle);
if(abandoned_only){
GET_DRIVER_OF_CAR(vehicle,&driver);
if(DOES_CHAR_EXIST(driver)) continue;
}
GET_DRIVER_OF_CAR(vehicle,&driver);
//if (driver == pPlayer) continue;//testing not to delete your own vehicle no matter what
if(mode != 1){
GET_CAR_MODEL(vehicle,&model);
if(mode == 2){
if(!IS_THIS_MODEL_A_CAR(model)) continue;
}
else if(mode == 3){
if(!IS_THIS_MODEL_A_BOAT(model)) continue;
}
else if(mode == 4){
if(!IS_THIS_MODEL_A_HELI(model)) continue;
}
else if(mode == 5){
if(!IS_THIS_MODEL_A_BIKE(model)) continue;
}
}
GET_CAR_COORDINATES(vehicle,&x,&y,&z);
GET_DISTANCE_BETWEEN_COORDS_3D(x,y,z,mx,my,mz,&distance);
if(distance > desired_distance) continue;
REQUEST_CONTROL_OF_NETWORK_ID(i);
if(!HAS_CONTROL_OF_NETWORK_ID(i)) continue;
nathan_clear_objects_on_car(vehicle);
DELETE_CAR(&vehicle);
}
WAIT(30);
}
}
C:
bool NETWORK_PLAYER_IS_ON_FRIENDS_LIST(int player_id)
{
register int i;
for(i = 0;i < NETWORK_GET_FRIEND_COUNT(); i++)
{
if(COMPARE_STRING(GET_PLAYER_NAME(player_id),NETWORK_GET_FRIEND_NAME(i))) return true;
}
return false;
}
Last edited: