[hELP!] Dialog skin Input before spawn!
#1

hello guys!

i want to use Dialog Input on my server..if player joined the server they had to put the skin id the dialog box...
and after player put the skin id example: "60" i want the server set him with that skin and automatically spawn at this coordinates:
Код:
2239.723, -1261.922, 23.9375
i have create my own script but not worked..after join the server..i put the skin id 12 and spawned as The truth? and spawn at Blueberry... I hope you guys can help me.. this is my code:


Код:
forward SkipSpawn(playerid);
Код:
public OnGameModeInit()
{
    SetGameModeText("Blank Script");
    for(new i = 1; i < 299; i++)

   {
	  AddPlayerClass(i, 2239.723, -1261.922, 23.9375,270.7165,0,0,0,0,0,0);
   }
    return 1;
}
Код:
public OnPlayerRequestClass(playerid, classid)
{
    SetTimerEx("SkipSpawn",1,0,"i",playerid);
    return 1;
}
Код:
public OnPlayerConnect(playerid)
{
    ShowPlayerDialog(playerid, Skin, DIALOG_STYLE_INPUT, "Change Skin", "Enter a skin ID below to get started", "Confirm", "Cancel");
    return 1;
}
Код:
public SkipSpawn(playerid)
{
  SpawnPlayer(playerid);
  return 1;
}
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if(dialogid == Skin)
    {
        if(response)
        {
            new skinid, message[64];
            skinid = strval(inputtext);
            if(skinid < 0 || skinid > 299)
            {
                SendClientMessage(playerid, 0x33FF33AA, "Error: Choose a skin ID between 0 and 299.");
            }
            else
            {
                SetPlayerSkin(playerid, skinid);
                format(message, sizeof(message), "You have successfully changed your skin id to %d.", skinid);
                SendClientMessage(playerid, 0x33FF33AA, message);
            }
        }
    }
    return 1;
}
please fix my code!!! and yes, i will reps!
Reply
#2

Where you set his skin, use SetSpawnInfo to spawn them.
Reply
#3

Quote:
Originally Posted by BleverCastard
Посмотреть сообщение
Where you set his skin, use SetSpawnInfo to spawn them.
I don't understand. can you send me the code or explain it more? I'm really new & noob to SA-MP scripting world.
Reply
#4

Hello!

Try this:
PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid == Skin)
    {
        if(
response)
        {
            new 
skinidmessage[64];
            
skinid strval(inputtext);
            if(
skinid || skinid 299)
            {
                
SendClientMessage(playerid0x33FF33AA"Error: Choose a skin ID between 0 and 299.");
            }
            else
            {
                
SetPlayerSkin(playeridskinid);
                
format(messagesizeof(message), "You have successfully changed your skin id to %d."skinid);
                
SendClientMessage(playerid0x33FF33AAmessage);
                
SetSpawnInfo(playerid,0,skinid,2239.723, -1261.92223.9375,270.7165,0,0,0,0,0,0);
            }
        }
    }
    return 
1;

I don't know that you have to use SpawnPlayer(playerid); too, but try this. If the code doesn't work, try this:
PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid == Skin)
    {
        if(
response)
        {
            new 
skinidmessage[64];
            
skinid strval(inputtext);
            if(
skinid || skinid 299)
            {
                
SendClientMessage(playerid0x33FF33AA"Error: Choose a skin ID between 0 and 299.");
            }
            else
            {
                
SetPlayerSkin(playeridskinid);
                
format(messagesizeof(message), "You have successfully changed your skin id to %d."skinid);
                
SendClientMessage(playerid0x33FF33AAmessage);
                
SetSpawnInfo(playerid,0,skinid,2239.723, -1261.92223.9375,270.7165,0,0,0,0,0,0);
                
SpawnPlayer(playerid);
            }
        }
    }
    return 
1;

Mencent
Reply
#5

@mencent - You don't have to place SetPlayerSkin if it's already going to be set in the SetSpawnInfo function.
Reply
#6

You are not forwarding
Add this up of the public and try

forward SkipSpawn();
Reply
#7

Lol, When i type skin id "1" in the dialog box and pressed confirm. I'm spawned as cj... Cj's skin id were "0" i rejoined the server and type again with skin id "2" and spawned as cj? Pls fix this
Reply
#8

Bump.
Reply
#9

As @Mencent said... This should work:
If it doesn't, tell me what is the exact problem.
pawn Код:
if(dialogid == Skin)
    {
        if(response)
        {
            new skinid, message[64];
            skinid = strval(inputtext);
            if(skinid < 0 || skinid > 299)
            {
                SendClientMessage(playerid, 0x33FF33AA, "Error: Choose a skin ID between 0 and 299.");
                Kick(playerid);
            }
            else
            {
                format(message, sizeof(message), "You have successfully changed your skin id to %d.", skinid);
                SendClientMessage(playerid, 0x33FF33AA, message);
                SetSpawnInfo(playerid,0,skinid,2239.723, -1261.922, 23.9375,270.7165,0,0,0,0,0,0);
                SpawnPlayer(playerid);
            }
        }
    }
Reply
#10

Quote:
Originally Posted by Ahmad45123
Посмотреть сообщение
As @Mencent said... This should work:
If it doesn't, tell me what is the exact problem.
pawn Код:
if(dialogid == Skin)
    {
        if(response)
        {
            new skinid, message[64];
            skinid = strval(inputtext);
            if(skinid < 0 || skinid > 299)
            {
                SendClientMessage(playerid, 0x33FF33AA, "Error: Choose a skin ID between 0 and 299.");
                Kick(playerid);
            }
            else
            {
                format(message, sizeof(message), "You have successfully changed your skin id to %d.", skinid);
                SendClientMessage(playerid, 0x33FF33AA, message);
                SetSpawnInfo(playerid,0,skinid,2239.723, -1261.922, 23.9375,270.7165,0,0,0,0,0,0);
                SpawnPlayer(playerid);
            }
        }
    }
It worked but, When i entered id Example "40 or "1" i keep spawning as CJ...
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)