Skin changeCommand works but doesnt change skin
#1

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;

Reply
#2

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.
Reply
#3

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.
Reply
#4

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
Reply
#5

But it do nothing as the past one.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)