SA-MP Forums Archive
Skin changeCommand works but doesnt change skin - 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: Skin changeCommand works but doesnt change skin (/showthread.php?tid=610737)



Skin changeCommand works but doesnt change skin - SkillNasr - 27.06.2016

Skinchange command not working
Im trying to start zcmd, so i did everything but i have 1 warning
Code:
warning 225: unreachable code
Line 11,
Code:
if (dialogid == 1)
. everytime i try it it work but not changing my skin
PHP Code:
#include <a_samp>
#include <a_players>
#include <zcmd>
#pragma tabsize 0
CMD:skin(playeridlistitemresponsedialogidinputtext[])
        {
         
ShowPlayerDialog(playerid1DIALOG_STYLE_INPUT"Skin Change""Enter the skin id you wish to have below""Confirm""Cancel");
                return 
1;
        if (
dialogid == 1)
        {
            if(
response)
                {
                    new 
skinidmessage[64];
                        
skinid strval(inputtext);
                        if(
skinid || skinid 299)
                        {
                            
SendClientMessage(playerid0xFFFFFFFF"SERVER: Skin id may be between 0 and 299.");
                        }
                        else
                        {
                            
SetPlayerSkin(playeridskinid);
                            
format(messagesizeof(message), "SERVER: You have changed your skin id to %d."skinid);
                            
SendClientMessage(playerid0xFFFFFFFFmessage);
                    }
                }
        }
            return 
1;




Re: Skin changeCommand works but doesnt change skin - Stinged - 27.06.2016

https://sampforum.blast.hk/showthread.php?tid=91354

zcmd is a command processor, it's supposed to 2 arguments, which are playerid and params.

What you're doing is showing the player the dialog, and doing what the dialog should do, all inside the command.
You're supposed to code what dialogs do under OnDialogResponse.


Re: Skin changeCommand works but doesnt change skin - Luicy. - 27.06.2016

Here:
PHP Code:
CMD:skin(playeridlistitemresponsedialogidinputtext[]) 

    
ShowPlayerDialog(playerid1DIALOG_STYLE_INPUT"Skin Change""Enter the skin id you wish to have below""Confirm""Cancel"); 
    if (
dialogid == 1
    { 
        if(
response
        { 
            new 
skinidmessage[64]; 
            
skinid strval(inputtext); 
            if(
skinid || skinid 299
            { 
                
SendClientMessage(playerid0xFFFFFFFF"SERVER: Skin id may be between 0 and 299."); 
            } 
            else 
            { 
                
SetPlayerSkin(playeridskinid); 
                
format(messagesizeof(message), "SERVER: You have changed your skin id to %d."skinid); 
                
SendClientMessage(playerid0xFFFFFFFFmessage); 
            } 
        } 
    } 
    return 
1

You can't return before it's finished, and you used return twice, removed the first return. Now should it be reachable.

Edit:

PHP Code:
CMD:skin(playerid

    
ShowPlayerDialog(playerid1DIALOG_STYLE_INPUT"Skin Change""Enter the skin id you wish to have below""Confirm""Cancel"); 
    return 
1
}  
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid == 1
    { 
        if(
response
        { 
            new 
skinidmessage[64]; 
            
skinid strval(inputtext); 
            if(
skinid || skinid 299
            { 
                
SendClientMessage(playerid0xFFFFFFFF"SERVER: Skin id may be between 0 and 299."); 
            } 
            else 
            { 
                
SetPlayerSkin(playeridskinid); 
                
format(messagesizeof(message), "SERVER: You have changed your skin id to %d."skinid); 
                
SendClientMessage(playerid0xFFFFFFFFmessage); 
            } 
        } 
    }

Read the reply above me.


Re: Skin changeCommand works but doesnt change skin - SkillNasr - 27.06.2016

Quote:
Originally Posted by Stinged
View Post
https://sampforum.blast.hk/showthread.php?tid=91354

zcmd is a command processor, it's supposed to 2 arguments, which are playerid and params.

What you're doing is showing the player the dialog, and doing what the dialog should do, all inside the command.
You're supposed to code what dialogs do under OnDialogResponse.
Thanks man i know that i forget something

Quote:
Originally Posted by Meller
View Post
Here:
PHP Code:
CMD:skin(playeridlistitemresponsedialogidinputtext[]) 

    
ShowPlayerDialog(playerid1DIALOG_STYLE_INPUT"Skin Change""Enter the skin id you wish to have below""Confirm""Cancel"); 
    if (
dialogid == 1
    { 
        if(
response
        { 
            new 
skinidmessage[64]; 
            
skinid strval(inputtext); 
            if(
skinid || skinid 299
            { 
                
SendClientMessage(playerid0xFFFFFFFF"SERVER: Skin id may be between 0 and 299."); 
            } 
            else 
            { 
                
SetPlayerSkin(playeridskinid); 
                
format(messagesizeof(message), "SERVER: You have changed your skin id to %d."skinid); 
                
SendClientMessage(playerid0xFFFFFFFFmessage); 
            } 
        } 
    } 
    return 
1

You can't return before it's finished, and you used return twice, removed the first return. Now should it be reachable.

Edit:

PHP Code:
CMD:skin(playerid

    
ShowPlayerDialog(playerid1DIALOG_STYLE_INPUT"Skin Change""Enter the skin id you wish to have below""Confirm""Cancel"); 
    return 
1
}  
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid == 1
    { 
        if(
response
        { 
            new 
skinidmessage[64]; 
            
skinid strval(inputtext); 
            if(
skinid || skinid 299
            { 
                
SendClientMessage(playerid0xFFFFFFFF"SERVER: Skin id may be between 0 and 299."); 
            } 
            else 
            { 
                
SetPlayerSkin(playeridskinid); 
                
format(messagesizeof(message), "SERVER: You have changed your skin id to %d."skinid); 
                
SendClientMessage(playerid0xFFFFFFFFmessage); 
            } 
        } 
    }

Read the reply above me.
Thanks m8, im gonna be sure to use it next time. im using Dialog atm then gonna update it to Textdraw


Re: Skin changeCommand works but doesnt change skin - SkillNasr - 27.06.2016

But it do nothing as the past one.