SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 27/06/2016, 08:01 PM   #1
SkillNasr
Big Clucker
 
SkillNasr's Avatar
 
Join Date: May 2013
Posts: 103
Reputation: 4
Default Skin changeCommand works but doesnt change skin

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;

__________________
If i've helped you, please click
SkillNasr is offline   Reply With Quote
Old 27/06/2016, 08:04 PM   #2
Stinged
High-roller
 
Join Date: Feb 2013
Posts: 1,575
Reputation: 187
Default Re: Skin changeCommand works but doesnt change skin

http://forum.sa-mp.com/showthread.php?t=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.
Stinged is offline   Reply With Quote
Old 27/06/2016, 08:04 PM   #3
Luicy.
Banned
 
Join Date: Dec 2014
Location: Sweden, Skövde
Posts: 776
Reputation: 79
Default Re: Skin changeCommand works but doesnt change skin

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.
Luicy. is offline   Reply With Quote
Old 27/06/2016, 08:14 PM   #4
SkillNasr
Big Clucker
 
SkillNasr's Avatar
 
Join Date: May 2013
Posts: 103
Reputation: 4
Default Re: Skin changeCommand works but doesnt change skin

Quote:
Originally Posted by Stinged View Post
http://forum.sa-mp.com/showthread.php?t=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
__________________
If i've helped you, please click
SkillNasr is offline   Reply With Quote
Old 27/06/2016, 08:16 PM   #5
SkillNasr
Big Clucker
 
SkillNasr's Avatar
 
Join Date: May 2013
Posts: 103
Reputation: 4
Default Re: Skin changeCommand works but doesnt change skin

But it do nothing as the past one.
__________________
If i've helped you, please click
SkillNasr 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
change skin alishvasis Scripting Help 0 09/02/2014 10:24 PM
Why when choosing skin, the skin doesnt show ? bustern Scripting Help 4 28/08/2013 02:54 PM
skin works good, but I spawn by the wrong place.. mickos Scripting Help 0 01/01/2013 05:56 PM
Cant change my skin bartje01 Help Archive 5 05/02/2010 09:19 AM
Why is the skin doesnt delete? nuriel8833 Help Archive 6 18/08/2009 10:59 AM


All times are GMT. The time now is 04:00 PM.


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