SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 03/08/2015, 12:46 PM   #1
Zonoya
Gangsta
 
Zonoya's Avatar
 
Join Date: Jul 2011
Location: Am I in Rio de Janeiro or the Amazon, you tell me?
Posts: 664
Reputation: 19
Default CreateDynamicCP Problem

Alright, so, I'll cut straight to the issue here. I've been making a /work system for my GM, and this is what I have for it thus far:

Code:
new tfCPs[][] = {
	{float:1727.6549, float:976.9305, float:11.8384, "Las Venturas Freight Depot"},
	{float:1663.4675, float:1045.9678, float:11.8445, "Las Venturas Freight Depot"},
	{float:2200.9333, float:-2234.3250, float:14.5604, "Los Santos Freight Depot"},
	{float:2169.7854, float:-2283.0378, float:14.4975, "Los Santos Freight Depot"},
	{float:-1843.5630, float:117.4490, float:16.1308, "San Fierro Freight Depot"},
	{float:-499.6371, float:-533.8455, float:26.5370, "Fallen Tree Freight Depot"},
	{float:65.4865, float:-279.0269, float:2.5962, "Blueberry Freight Depot"},
	{float:2811.5369, float:968.3643, float:11.7686, "Rockshore East Freight Depot"},
	{float:2850.6057, float:929.6235, float:11.7607, "Rockshore East Freight Depot"},
	{float:-2262.2161, float:2301.7561, float:5.8391, "Bayside Marina Freight Depot"},
	{float:-2093.3074, float:-2241.3704, float:31.8672, "Angel Pine Freight Depot"}
};
And

Code:
CMD:work(playerid,params[])
{
	if(!IsPlayerInAnyVehicle(playerid)) return Error(playerid, "You must be in some sort of vehicle to use this command!");
	new vMod;
	vMod = GetVehicleModel(GetPlayerVehicleID(playerid));
	switch(vMod) {
		case 578, 455, 403, 433, 514, 515, 407, 544, 427: {
			format(pMissionType[playerid], 30, "Trucking");
			new rNum = random(sizeof(tfCPs));
			WorkCP[playerid] = CreateDynamicCP(tfCPs[rNum][0], tfCPs[rNum][1], tfCPs[rNum][2], 10, -1, -1, playerid, 99999999);
			pLastCP[playerid] = rNum;
			SCFM(playerid, SCM_C_YELLOW, "Collect freight at %s!", tfCPs[rNum][3]);
		} default: return Error(playerid, "Your vehicle is not applicable to working in!");
	} return 1;
}
There's more, but this is what's applicable to my problem.

This script works fine, up until it creates the checkpoint. The checkpoint refuses to show up on my map ingame, and I know it's not an issue with the streamer plugin, because if I put a checkpoint in there to go to 0, 0, 0 as coordinates, that one displays fine, so I'm a bit lost now...

What's causing this checkpoint in particular to refuse to show, and how can I fix it?

Thanks, Zon.
__________________
Code:
public OnRconLoginAttempt(ip[], password[], success)
{
    if(!success) //If the password was incorrect
    {
        printf("FAILED RCON LOGIN BY IP %s USING PASSWORD %s",ip, password);
        new pip[16];
        for(new i=0; i<MAX_PLAYERS; i++) //Loop through all players
        {
            GetPlayerIp(i, pip, sizeof(pip));
            if(!strcmp(ip, pip, true)) //If a player's IP is the IP that failed the login
            {
                SendClientMessage(i, 0xFFFFFFFF, "Wrong Password. Bye!"); //Send a message
                Ban(i); //They are now banned.
            }
        }
    }
    return 1;
}
Zonoya is offline   Reply With Quote
Old 03/08/2015, 12:48 PM   #2
dominik523
Gangsta
 
dominik523's Avatar
 
Join Date: Feb 2013
Location: Croatia
Posts: 843
Reputation: 115
Default Re: CreateDynamicCP Problem

Okay so I'm not sure will this fix anything, but try to replace all "float" with "Float". It might be an issue with tags, I'm not sure but try it anyways.
This happened to me once and the problem was too low Z coordinate from the actual position so try to increase it also.
__________________
[Tutorial] Using new SHA-256 function
dominik523 is offline   Reply With Quote
Old 03/08/2015, 12:52 PM   #3
Zonoya
Gangsta
 
Zonoya's Avatar
 
Join Date: Jul 2011
Location: Am I in Rio de Janeiro or the Amazon, you tell me?
Posts: 664
Reputation: 19
Default Re: CreateDynamicCP Problem

Quote:
Originally Posted by dominik523 View Post
Okay so I'm not sure will this fix anything, but try to replace all "float" with "Float". It might be an issue with tags, I'm not sure but try it anyways.
This happened to me once and the problem was too low Z coordinate from the actual position so try to increase it also.
The z coord was taken from inside a roadtrain, so I doubt that's a major issue, as for changing 'float' to 'Float', that just gave me 33 tag mismatch errors, as well as not working
__________________
Code:
public OnRconLoginAttempt(ip[], password[], success)
{
    if(!success) //If the password was incorrect
    {
        printf("FAILED RCON LOGIN BY IP %s USING PASSWORD %s",ip, password);
        new pip[16];
        for(new i=0; i<MAX_PLAYERS; i++) //Loop through all players
        {
            GetPlayerIp(i, pip, sizeof(pip));
            if(!strcmp(ip, pip, true)) //If a player's IP is the IP that failed the login
            {
                SendClientMessage(i, 0xFFFFFFFF, "Wrong Password. Bye!"); //Send a message
                Ban(i); //They are now banned.
            }
        }
    }
    return 1;
}
Zonoya is offline   Reply With Quote
Old 03/08/2015, 05:01 PM   #4
Zonoya
Gangsta
 
Zonoya's Avatar
 
Join Date: Jul 2011
Location: Am I in Rio de Janeiro or the Amazon, you tell me?
Posts: 664
Reputation: 19
Default Re: CreateDynamicCP Problem

Nevermind, it was an issue with having strings and floats in the same array. Fixed.
__________________
Code:
public OnRconLoginAttempt(ip[], password[], success)
{
    if(!success) //If the password was incorrect
    {
        printf("FAILED RCON LOGIN BY IP %s USING PASSWORD %s",ip, password);
        new pip[16];
        for(new i=0; i<MAX_PLAYERS; i++) //Loop through all players
        {
            GetPlayerIp(i, pip, sizeof(pip));
            if(!strcmp(ip, pip, true)) //If a player's IP is the IP that failed the login
            {
                SendClientMessage(i, 0xFFFFFFFF, "Wrong Password. Bye!"); //Send a message
                Ban(i); //They are now banned.
            }
        }
    }
    return 1;
}
Zonoya is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Steamer]:CreateDynamicCP size problem[Help] UserName31 Scripting Help 0 21/07/2014 09:10 PM
CreateDynamicCP problem Dusan01 Scripting Help 12 13/03/2014 05:41 PM
CreateDynamicCP Problem Rokzlive Scripting Help 3 13/02/2014 01:04 AM
CreateDynamicCP megamind2067 Scripting Help 4 29/01/2013 11:27 PM
CreateDynamicCP problem wolfdude Scripting Help 5 02/09/2012 07:30 PM


All times are GMT. The time now is 01:46 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.