04-04-2012,10:56 AM
Hey mates,
I'm friend with Verizo or rather my name is NeedForSpeedXP and have a very important question.
im working on the object spawner as well just for private use. We need your help to find out the problem and get the file compiled properly. We put the model names into consts.h. and tried two ways to get it to work but it didn't work at all unfortunately. The 1st method was to change the name of LoadModel to the command which was actually in the natives.h (REQUEST_MODEL) and for CreateVehicle we tried the same (CREATE_CAR or CREATE_OBJECT). The 2nd one was to add a number to the SpawnMeA in braces [] and declare it in a void afterwards. The compiler didn't work on both methods but we got a lot further with the second method then with the first one. Here is the first method (modscript.c):
Spoiler
Code:
MODSCRIPT.C:
/***********************************************************************
Fully stripped main script
This file is a part of scocl project by Alexander Blade (c) 2011
***********************************************************************/
#include <natives.h>
#include <common.h>
#include <strings.h>
#include <types.h>
#include <consts.h>
/****************************************************
Spawn Veh (working)
*****************************************************/
void main()
boolean isCarSpawnMenuOn = 0;
boolean Carint = 1;
void SpawnMeA(uint vehiclemodel)
{
float x, y, z;
GET_CHAR_COORDINATES(GetPlayerPed(), &x, &y, &z);
REQUEST_MODEL(vehiclemodel);
CREATE_CAR(SpawnMeA, x+5, y=0, z+5, &SpawnMeA, 1);
}
void PrintMenu(char *stg)
{
//SET_TEXT_COLOUR(255, 140, 0, 255);
PRINT_STRING_WITH_LITERAL_STRING_NOW("STRING", stg, 5000, 1);
}
void SetCarspawnmenuon(void)
{
// if((IS_BUTTON_PRESSED(0,DPAD_LEFT)) && (IS_BUTTON_PRESSED(0,STICK_R)) && (IS_BUTTON_PRESSED(0,R1))) // MENU ON OR OFF (L+R STICK AND R1)
if(IS_GAME_KEYBOARD_KEY_PRESSED(KEY_F10))
{
if (isCarSpawnMenuOn == 0)
{
isCarSpawnMenuOn = 1;
PrintMenu("Object Spawner ON");
}
else if(isCarSpawnMenuOn == 1)
{
isCarSpawnMenuOn = 0;
PrintMenu("Object Spawner OFF");
}
}
}
void PressXToSpawnCarNow(void)
{
if((IS_KEYBOARD_KEY_PRESSED(KEY_ENTER)) && (isCarSpawnMenuOn == 1)) // GETS INFO AND IF ALLOWED WILL SPAWN USING X
{
if (Carint == 1) //checks if this value is true before spawning Veh
{
SpawnMeA(MODEL_AG_tree00);
}
else if(Carint == 2)
{
SpawnMeA(MODEL_AG_TREE02);
}
else if(Carint == 3)
{
SpawnMeA(MODEL_AG_tree06);
}
else if(Carint == 4)
{
SpawnMeA(MODEL_AP_CP_Door_01);
}
else if(Carint == 5)
{
SpawnMeA(MODEL_AP_CP_Door_02);
}
else if(Carint == 6)
{
SpawnMeA(MODEL_AP_ladder_01);
}
else if(Carint == 7)
{
SpawnMeA(MODEL_AP_ladder_02);
}
}
}
void SpawnListNavLeft(void)
{
if((IS_GAME_KEYBOARD_KEY_JUST_PRESSED(KEY_B)) && (isCarSpawnMenuOn == 1)) //NAVIGATION BACK
{
if(Carint == 1)
{
Carint = 7;
PrintMenu("AP_ladder_02");
}
else if(Carint == 7)
{
Carint = 6;
PrintMenu("AP_ladder_01");
}
else if(Carint == 6)
{
Carint = 5;
PrintMenu("AP_CP_Door_02");
}
else if(Carint == 5)
{
Carint = 4;
PrintMenu("AP_CP_Door_01");
}
else if(Carint == 4)
{
Carint = 3;
PrintMenu("AG_tree06");
}
else if(Carint == 3)
{
Carint = 2;
PrintMenu("AG_TREE02");
}
else if(Carint == 2)
{
Carint = 1;
PrintMenu("AG_tree00");
}
}
}
void SpawnListNavRright(void)
{
if((IS_GAME_KEYBOARD_KEY_JUST_PRESSED(KEY_M)) && (isCarSpawnMenuOn == 1)) //NAVIGATION FORWARD
{
if(Carint == 1)
{
Carint = 2;
PrintMenu("AG_TREE02"); //text needs to be here as well as on SpawnListNav Left
}
else if(Carint == 2)
{
Carint = 3;
PrintMenu("AG_tree06");
}
else if(Carint == 3)
{
Carint = 4;
PrintMenu("AP_CP_Door_01");
}
else if(Carint == 4)
{
Carint = 5;
PrintMenu("AP_CP_Door_02");
}
else if(Carint == 5)
{
Carint = 6;
PrintMenu("AP_ladder_01");
}
else if(Carint == 6)
{
Carint = 7;
PrintMenu("AP_ladder_02");
}
else if(Carint == 7) //if at the end of list loop to the beginning
{
Carint = 1; // this # will represent the beinning
PrintMenu("AG_tree00");
}
}
}
void CarSpawner(void)
{
SpawnListNavRright();
SpawnListNavLeft();
PressXToSpawnCarNow();
SetCarspawnmenuon();
}
/*SpawnMeA[0] = 0xDE6E4CD4;
SpawnMeA[1] = 0xBACB858F;
SpawnMeA[2] = 0x06549CA0;
SpawnMeA[3] = 0xDC0513AA;
SpawnMeA[4] = 0xF1BB3F16;
SpawnMeA[5] = 0x4382DC22;
SpawnMeA[6] = 0xF1BCB897;
2nd method:
Spoiler
Code:
/***********************************************************************
Fully stripped main script
This file is a part of scocl project by Alexander Blade (c) 2011
***********************************************************************/
#include <natives.h>
#include <common.h>
#include <strings.h>
#include <types.h>
#include <consts.h>
/****************************************************
Spawn Veh (working)
*****************************************************/
void main()
boolean isCarSpawnMenuOn = 0;
boolean Carint = 1;
void SpawnMeA(uint vehiclemodel)
{
float x, y, z;
GET_CHAR_COORDINATES(GetPlayerPed(), &x, &y, &z);
REQUEST_MODEL(vehiclemodel);
CREATE_CAR(SpawnMeA, x+5, y=0, z+5, &SpawnMeA, 1);
}
void PrintMenu(char *stg)
{
//SET_TEXT_COLOUR(255, 140, 0, 255);
PRINT_STRING_WITH_LITERAL_STRING_NOW("STRING", stg, 5000, 1);
}
void SetCarspawnmenuon(void)
{
// if((IS_BUTTON_PRESSED(0,DPAD_LEFT)) && (IS_BUTTON_PRESSED(0,STICK_R)) && (IS_BUTTON_PRESSED(0,R1))) // MENU ON OR OFF (L+R STICK AND R1)
if(IS_GAME_KEYBOARD_KEY_PRESSED(KEY_F10))
{
if (isCarSpawnMenuOn == 0)
{
isCarSpawnMenuOn = 1;
PrintMenu("Object Spawner ON");
}
else if(isCarSpawnMenuOn == 1)
{
isCarSpawnMenuOn = 0;
PrintMenu("Object Spawner OFF");
}
}
}
void PressXToSpawnCarNow(void)
{
if((IS_KEYBOARD_KEY_PRESSED(KEY_ENTER)) && (isCarSpawnMenuOn == 1)) // GETS INFO AND IF ALLOWED WILL SPAWN USING X
{
if (Carint == 1) //checks if this value is true before spawning Veh
{
SpawnMeA[0](MODEL_AG_tree00);
}
else if(Carint == 2)
{
SpawnMeA[1](MODEL_AG_TREE02);
}
else if(Carint == 3)
{
SpawnMeA[2](MODEL_AG_tree06);
}
else if(Carint == 4)
{
SpawnMeA[3](MODEL_AP_CP_Door_01);
}
else if(Carint == 5)
{
SpawnMeA[4](MODEL_AP_CP_Door_02);
}
else if(Carint == 6)
{
SpawnMeA[5](MODEL_AP_ladder_01);
}
else if(Carint == 7)
{
SpawnMeA[6](MODEL_AP_ladder_02);
}
}
}
void SpawnListNavLeft(void)
{
if((IS_GAME_KEYBOARD_KEY_JUST_PRESSED(KEY_B)) && (isCarSpawnMenuOn == 1)) //NAVIGATION BACK
{
if(Carint == 1)
{
Carint = 7;
PrintMenu("AP_ladder_02");
}
else if(Carint == 7)
{
Carint = 6;
PrintMenu("AP_ladder_01");
}
else if(Carint == 6)
{
Carint = 5;
PrintMenu("AP_CP_Door_02");
}
else if(Carint == 5)
{
Carint = 4;
PrintMenu("AP_CP_Door_01");
}
else if(Carint == 4)
{
Carint = 3;
PrintMenu("AG_tree06");
}
else if(Carint == 3)
{
Carint = 2;
PrintMenu("AG_TREE02");
}
else if(Carint == 2)
{
Carint = 1;
PrintMenu("AG_tree00");
}
}
}
void SpawnListNavRright(void)
{
if((IS_GAME_KEYBOARD_KEY_JUST_PRESSED(KEY_M)) && (isCarSpawnMenuOn == 1)) //NAVIGATION FORWARD
{
if(Carint == 1)
{
Carint = 2;
PrintMenu("AG_TREE02"); //text needs to be here as well as on SpawnListNav Left
}
else if(Carint == 2)
{
Carint = 3;
PrintMenu("AG_tree06");
}
else if(Carint == 3)
{
Carint = 4;
PrintMenu("AP_CP_Door_01");
}
else if(Carint == 4)
{
Carint = 5;
PrintMenu("AP_CP_Door_02");
}
else if(Carint == 5)
{
Carint = 6;
PrintMenu("AP_ladder_01");
}
else if(Carint == 6)
{
Carint = 7;
PrintMenu("AP_ladder_02");
}
else if(Carint == 7) //if at the end of list loop to the beginning
{
Carint = 1; // this # will represent the beinning
PrintMenu("AG_tree00");
}
}
}
void CarSpawner(void)
{
SpawnListNavRright();
SpawnListNavLeft();
PressXToSpawnCarNow();
SetCarspawnmenuon();
}
SpawnMeA[0] = 0xDE6E4CD4;
SpawnMeA[1] = 0xBACB858F;
SpawnMeA[2] = 0x06549CA0;
SpawnMeA[3] = 0xDC0513AA;
SpawnMeA[4] = 0xF1BB3F16;
SpawnMeA[5] = 0x4382DC22;
SpawnMeA[6] = 0xF1BCB897;
Hopefully you can help us! Thanks in advance!
Best regards,
N4SXP
Hail EvilB, JDMAlex and nativesith