SA-MP Forums Archive
Teleporting system - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Teleporting system (/showthread.php?tid=632479)



Teleporting system - 1fret - 15.04.2017

I once made an thread on this forums about a tp system, anyhow i tried to do it by my self which it works greate only issue is im trying to ad and 3d text to it.. But when i try to create the tp it creates the 3d text good but when i try to change the name only one 3dtext name changes and im wondering why

PHP код:
    if(!strcmp(params"text"true4))
        {
            if(
sscanf(params"s[128]is[128]"paramsidxtext)) return SendClientMessage(playeriderror"Usage: /dedit text [doorid] [text]");
            if(
DoorInfo[idx][dType] == 0) return SendClientMessage(playeriderror"Invalid door id.");
            
format(DoorInfo[idx][dText], 128"%s"text);
            
format(stringsizeof(string), ""COE"%s (%d)"DoorInfo[idx][dText] , idx);
            
UpdateDynamic3DTextLabelText(DoorInfo[idx][dTextID], -1string);
               
format(DoorInfo[idx][iText], 128"%s"text);
            
format(stringsizeof(string), ""COE"%s (%d)"DoorInfo[idx][iText] , idx);
            
UpdateDynamic3DTextLabelText(DoorInfo[idx][dTextID], -1string);
            
format(stringsizeof(string), " You have set door ID %d's text to %s"idxtext);
            
SendClientMessage(playerid, -1string);
        }
        if(!
strcmp(params"interior"true8))
        {
            if(
sscanf(params"s[128]i"paramsidxtext)) return SendClientMessage(playeriderror"Usage: /dedit interior [doorid]");
            if(
DoorInfo[idx][dType] == 0) return SendClientMessage(playeriderror"Invalid door id.");
            
DoorInfo[idx][dIInt] = GetPlayerInterior(playerid);
            
DoorInfo[idx][dIVW] = GetPlayerVirtualWorld(playerid);
            
GetPlayerFacingAngle(playeridDoorInfo[idx][dIA]);
            
GetPlayerPos(playeridDoorInfo[idx][dIX], DoorInfo[idx][dIY], DoorInfo[idx][dIZ]);
            
format(stringsizeof(string), ""COE"%s (%d)"DoorInfo[idx][iText] , idx);
            
DoorInfo[idx][dTextID] = CreateDynamic3DTextLabel(string, -1DoorInfo[idx][dIX], DoorInfo[idx][dIY], DoorInfo[idx][dIZ]+0.315);
            
format(stringsizeof(string), " You have set door ID %d's interior to your coordinates. (Int: %d | VW: %d)"idxGetPlayerInterior(playerid), GetPlayerVirtualWorld(playerid));
            
SendClientMessage(playerid, -1string);
        } 
Also whenever i start the local host it shows a message like this
PHP код:
sscanf warningFormat specifier does not match parameter count
i dont know how to fix it can you help me, i will be active on forums and is awaiting any reply


Re: Teleporting system - DarkSkull - 15.04.2017

PHP код:
if(sscanf(params"s[128]i"paramsidxtext)) return SendClientMessage(playeriderror"Usage: /dedit interior [doorid]"); 
The sscanf error comes due to this line. You have specified two specifiers, but three parameters.

Change it to this:
this is the sscanf in the interior part of the code.
EDIT: UPDATED THE CODE TO SUPPORT 2 Parameters.
PHP код:
if(sscanf(params"s[128]i"paramsidx)) return SendClientMessage(playeriderror"Usage: /dedit interior [doorid]"); 
As for the 3D label, I don't see you updating the 3d text label in the interior part of the code.


Re: Teleporting system - 1fret - 15.04.2017

Quote:
Originally Posted by DarkSkull
Посмотреть сообщение
PHP код:
if(sscanf(params"s[128]i"paramsidxtext)) return SendClientMessage(playeriderror"Usage: /dedit interior [doorid]"); 
The sscanf error comes due to this line. You have specified two specifiers, but three parameters.

Change it to this:
this is the sscanf in the interior part of the code.
EDIT: UPDATED THE CODE TO SUPPORT 2 Parameters.
PHP код:
if(sscanf(params"s[128]i"paramsidx)) return SendClientMessage(playeriderror"Usage: /dedit interior [doorid]"); 
As for the 3D label, I don't see you updating the 3d text label in the interior part of the code.
Ok thanks for the sscanf fix, but now let me try to explain a bit more with some diagrams....


this is how it looks when i create first create the tp... the blue arrow indicates the frist created tp(exterior) and the red arrow indicates the last tp created(interior).


Now when i try to edit the name cause i want both tps to have the same name now when i try to change the name only the last tp name changes and the first tp name doesnt update..


Re: Teleporting system - DarkSkull - 15.04.2017

Can you show the code for exterior as well?


Re: Teleporting system - 1fret - 15.04.2017

Quote:
Originally Posted by DarkSkull
Посмотреть сообщение
Can you show the code for exterior as well?
PHP код:
    if(!strcmp(params"exterior"true8))
        {
            if(
sscanf(params"s[128]i"paramsidx)) return SendClientMessage(playeriderror"Usage: /dedit interior [doorid]");
            if(
DoorInfo[idx][dType] == 0) return SendClientMessage(playerid,error"Invalid door id.");
            
DoorInfo[idx][dOInt] = GetPlayerInterior(playerid);
            
DoorInfo[idx][dOVW] = GetPlayerVirtualWorld(playerid);
            
GetPlayerFacingAngle(playeridDoorInfo[idx][dOA]);
            
GetPlayerPos(playeridDoorInfo[idx][dOX], DoorInfo[idx][dOY], DoorInfo[idx][dOZ]);
            
DestroyDynamicPickup(DoorInfo[idx][dPickup]);
            
DoorInfo[idx][dPickup] = CreateDynamicPickup(DoorInfo[idx][dType], 1DoorInfo[idx][dOX], DoorInfo[idx][dOY], DoorInfo[idx][dOZ], DoorInfo[idx][dOVW], DoorInfo[idx][dOInt]);
            
DestroyDynamic3DTextLabel(DoorInfo[idx][dTextID]);
            
format(stringsizeof(string), ""COE"%s (%d)"DoorInfo[idx][dText] , idx);
            
DoorInfo[idx][dTextID] = CreateDynamic3DTextLabel(string, -1DoorInfo[idx][dOX], DoorInfo[idx][dOY], DoorInfo[idx][dOZ]+0.315);
            
format(stringsizeof(string), " You have set door ID %d's exterior to your coordinates. (Int: %d | VW: %d)"idxGetPlayerInterior(playerid), GetPlayerVirtualWorld(playerid));
            
SendClientMessage(playerid, -1string);
        } 



Re: Teleporting system - DarkSkull - 15.04.2017

PHP код:
 if(sscanf(params"s[128]is[128]"paramsidxtext)) return SendClientMessage(playeriderror"Usage: /dedit text [doorid] [text]"); 
You text sscanf is also messed up. You are using three specifiers and 3 parameters, But you don't need the first string. I'm not sure if that is the problem here, But you might as well try to fix that. Here's the fix for it.

PHP код:
 if(sscanf(params"is[128]"idxtext)) return SendClientMessage(playeriderror"Usage: /dedit text [doorid] [text]"); 
Also I've noticed something. In your interior and exterior, where you update the coordinates, You use text and idx, But you only use the id and not the text. Here are fixes for both of them as well.

PHP код:
if(sscanf(params"i"idx)) return SendClientMessage(playeriderror"Usage: /dedit interior [doorid]"); // interior
if(sscanf(params"i"idx)) return SendClientMessage(playeriderror"Usage: /dedit exterior [doorid]"); // exterior 
Try these and check if it fixxes it


Re: Teleporting system - 1fret - 15.04.2017

Quote:
Originally Posted by DarkSkull
Посмотреть сообщение
PHP код:
 if(sscanf(params"s[128]is[128]"paramsidxtext)) return SendClientMessage(playeriderror"Usage: /dedit text [doorid] [text]"); 
You text sscanf is also messed up. You are using three specifiers and 3 parameters, But you don't need the first string. I'm not sure if that is the problem here, But you might as well try to fix that. Here's the fix for it.

PHP код:
 if(sscanf(params"is[128]"idxtext)) return SendClientMessage(playeriderror"Usage: /dedit text [doorid] [text]"); 
Also I've noticed something. In your interior and exterior, where you update the coordinates, You use text and idx, But you only use the id and not the text. Here are fixes for both of them as well.

PHP код:
if(sscanf(params"i"idx)) return SendClientMessage(playeriderror"Usage: /dedit interior [doorid]"); // interior
if(sscanf(params"i"idx)) return SendClientMessage(playeriderror"Usage: /dedit exterior [doorid]"); // exterior 
Try these and check if it fixxes it
I have fixed the sscanf error , now about the interior and exterior thing... I just want if i change tp1 name to Chicken it will update the both texts so tp2 name will also be changed to Chicken...


Re: Teleporting system - DarkSkull - 15.04.2017

What you need to do is update both the door ids. Do you store the id of the corresponding exterior for an interior and vice versa? Can you show us your enum?


Re: Teleporting system - 1fret - 15.04.2017

RESOLVED