Post: I have no idea what I'm doing. Help fix my script?
06-25-2012, 09:03 AM #1
Saul
¯\_(ツWinky Winky_/¯
(adsbygoogle = window.adsbygoogle || []).push({}); This compiles fine but when I enable it in the mod selector, it does nothing except disable itself in the mod selector.

I'm really not sure of what I'm doing, I just copied some bits and pieces out of a decompiled v1.0 script, and went from there. If it's not obvious, I'm trying to make a thing that behaves like the object spawner but for teleporting to each pigeon in sp.
    #include <natives.h>
#include <common.h>
#include <strings.h>
#include <types.h>
#include <consts.h>

void main(void)
{
if (IS_GAME_KEYBOARD_KEY_JUST_PRESSED(8Cool Man (aka Tustin))
{
int Var1 = 0;
int Var2 = 0;
int Var3 = 1;
int Var4 = 0;
float Var5 = 0;
float Var6 = 0;
float Var7 = 0;
float Var8 = 0;
while (!Var1)
{
WAIT(0);
if (Var2 == 0)
{
Var8 = 1383.28;
Var7 = -740.90;
Var6 = 9.42;
Var5 = 0.0;
if (Var3)
{
PRINT_STRING_WITH_LITERAL_STRING_NOW("STRING", "Teleport to Pigeon 1.", 172800000, 1);
Var3 = 0;
}
}
if (Var2 == 1)
{
Var8 = 1600.55;
Var7 = 176.63;
Var6 = 23.07;
Var5 = 0.0;
if (Var3)
{
PRINT_STRING_WITH_LITERAL_STRING_NOW("STRING", "Teleport to Pigeon 2.", 172800000, 1);
Var3 = 0;
}
}
if (Var2 == 2)
{
Var8 = 1434.26;
Var7 = 207.77;
Var6 = 31.65;
Var5 = 0.0;
if (Var3)
{
PRINT_STRING_WITH_LITERAL_STRING_NOW("STRING", "Teleport to Pigeon 3.", 172800000, 1);
Var3 = 0;
}
}
if (IS_GAME_KEYBOARD_KEY_JUST_PRESSED(4Cool Man (aka Tustin))
{
if (Var2 == 0)
{
Var2 = 2;
}
else
{
Var2 = Var2 - 1;
}
Var3 = 1;
}
if (IS_GAME_KEYBOARD_KEY_JUST_PRESSED(50))
{
if (Var2 == 2)
{
Var2 = 0;
}
else
{
Var2 = Var2 + 1;
}
Var3 = 1;
}
if (IS_GAME_KEYBOARD_KEY_JUST_PRESSED(2Cool Man (aka Tustin))
{
GET_PLAYER_CHAR(CONVERT_INT_TO_PLAYERINDEX(GET_PLAYER_ID()), &Var4);
Var4 = Var4;
SET_CHAR_COORDINATES(Var4, Var8, Var7, Var6);
SET_GAME_CAM_HEADING(Var5);
REQUEST_COLLISION_AT_POSN(Var8, Var7, Var6);
LOAD_ALL_OBJECTS_NOW();
}
if (IS_GAME_KEYBOARD_KEY_JUST_PRESSED(1))
{
PRINT_STRING_WITH_LITERAL_STRING_NOW("STRING", "", 172800000, 1);
Var1 = 1;
}
}
}
}


You must login or register to view this content.
(adsbygoogle = window.adsbygoogle || []).push({});
06-25-2012, 03:26 PM #2
slim355
You talkin to me?
Decompiled Scripts will not work, there is not enough info in the .sco to re-create working C code.
I haven't tried compile this but it should give you an idea what to do.

    
#include <natives.h>
#include <common.h>
#include <strings.h>
#include <types.h>
#include <consts.h>

void main(void)
{
Player Player_Ped = GetPlayerPed();
float x, y, z;
float cam_heading;

PRINT_STRING_WITH_LITERAL_STRING_NOW("STRING", "Pigeon Teleporter", 5000, 1);
while(true)
{
WAIT(0);
if(IS_BUTTON_JUST_PRESSED( 0 , DPAD_RIGHT))
{
x = 1383.28;
y = -740.90;
z = 9.42;
cam_heading = 0.0;
Custom_Teleport(Player_Ped,x,y,z,cam_heading);
}
if(IS_BUTTON_JUST_PRESSED( 0 , TRIANGLE))
{
//Quit
break;
}
}
}

void Custom_Teleport(Player Player_Ped,float x,float y,float z, float cam_heading)
{
SET_CHAR_COORDINATES(Player_Ped, x, y, z);
SET_GAME_CAM_HEADING(cam_heading);
REQUEST_COLLISION_AT_POSN(x, y, z);
LOAD_ALL_OBJECTS_NOW();
PRINT_STRING_WITH_LITERAL_STRING_NOW("STRING", "Teleported", 5000, 1);
}

The following user thanked slim355 for this useful post:

Saul
06-26-2012, 09:38 AM #3
Saul
¯\_(ツWinky Winky_/¯
Thanks for that, I should have just started with three socks example sources. I started over using them and, SUCCESS :happygrin:

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo