Returning a CMD!
#1

I have a antifall command. Its fuction is to only Send the Player a Message but it also has a Variable and the Variable has the main function. When I do /antifall, it Send me the Message and the Varible performs its function but when I use return CMD_antifall( playerid ), it Sends me the message but the variable doesnt perform its function but the variable becomes 1 when it is 0 and 0 when it is 1. Why isnt it performing its function? Can anybody help!
Reply
#2

Lol,did you made any function for it?
Reply
#3

show code i think u may have returned multiple (semantic error bro)
Reply
#4

I returned the Command while making a /settings command. Here is the Code:

Command:
PHP Code:
CMD:antifallplayerid )
{
 if(
Act[playerid] == 0)
    {
     
Act[playerid] = 1;
        
SendClientMessage(playerid,-1,">>>"GREEN" Antifall Enabled!");
    }
    else if(
Act[playerid] == 1)
    {
        
SendClientMessage(playerid,-1,">>>"RED" Antifall Disabled!");
        
Act[playerid] = 0;
    }
    return 
1;

Function of the Variable:
PHP Code:
public OnPlayerStateChange(playeridnewstateoldstate)
{
        if(
Act[playerid] == 1)
        {
                if(
oldstate == PLAYER_STATE_DRIVER)
                {
                        if(
newstate == PLAYER_STATE_ONFOOT)
                        {
                                if(
InCar[playerid] == 1)
                                {
                                        
PutPlayerInVehicle(playeridWhatCar[playerid], Driver);
                                }
                        }
                }
                if(
oldstate == PLAYER_STATE_PASSENGER)
                {
                        if(
newstate == PLAYER_STATE_ONFOOT)
                        {
                                if(
InCar[playerid] == 1)
                                {
                                        
PutPlayerInVehicle(playeridWhatCar[playerid], Passanger);
                                }
                        }
                }
                if(
oldstate == PLAYER_STATE_ONFOOT)
                {
                        if(
newstate == PLAYER_STATE_DRIVER || PLAYER_STATE_PASSENGER)
                        {
                                
InCar[playerid] = 1;
                                
WhatCar[playerid] = GetPlayerVehicleID(playerid);
                        }
                }
        }
        return 
1;

The Settings Stock:
PHP Code:
stock ShowSettings (playerid)
{
    new 
str[350];
    new 
Antifal[40];
    if (
Act[playerid] == 1format(Antifal40GREEN"Enabled");
    if (
Act[playerid] == 0format(Antifal40RED"Disabled");
    
format(strsizeof(str), "Antifall (%s{FFFFFF})"Antifal);
    
ShowPlayerDialog(playeridDIALOGID_SETTINGSDIALOG_STYLE_LISTREDORANGE">> {FFFFFF}Account Settings"str"OK""Cancel");
    return 
1;

The Place where the command is returned:
PHP Code:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if (
dialogid == DIALOGID_SETTINGS) {
        if (!
response) return 1;
        if (
response) { Timer1[playerid] = SetTimerEx("Settings"50true"i"playerid);
            switch (
listitem)
            {
                case 
0:
                {
                    return 
CMD_godplayerid );
                }
                case 
1:
                {
                     return 
CMD_antifallplayerid );
                }
            }
        }
    }
    return 
1;

Please help me!
Reply
#5

Try it changing CMD_antifall to cmd_antifall im not sure though
Edit u made it like that 0 to become 1 and when 1 to become 0 so wat is problem??
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)