I returned the Command while making a /settings command. Here is the Code:
Command:
PHP Code:
CMD:antifall( playerid )
{
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(playerid, newstate, oldstate)
{
if(Act[playerid] == 1)
{
if(oldstate == PLAYER_STATE_DRIVER)
{
if(newstate == PLAYER_STATE_ONFOOT)
{
if(InCar[playerid] == 1)
{
PutPlayerInVehicle(playerid, WhatCar[playerid], Driver);
}
}
}
if(oldstate == PLAYER_STATE_PASSENGER)
{
if(newstate == PLAYER_STATE_ONFOOT)
{
if(InCar[playerid] == 1)
{
PutPlayerInVehicle(playerid, WhatCar[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] == 1) format(Antifal, 40, GREEN"Enabled");
if (Act[playerid] == 0) format(Antifal, 40, RED"Disabled");
format(str, sizeof(str), "Antifall (%s{FFFFFF})", Antifal);
ShowPlayerDialog(playerid, DIALOGID_SETTINGS, DIALOG_STYLE_LIST, REDORANGE">> {FFFFFF}Account Settings", str, "OK", "Cancel");
return 1;
}
The Place where the command is returned:
PHP Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if (dialogid == DIALOGID_SETTINGS) {
if (!response) return 1;
if (response) { Timer1[playerid] = SetTimerEx("Settings", 50, true, "i", playerid);
switch (listitem)
{
case 0:
{
return CMD_god( playerid );
}
case 1:
{
return CMD_antifall( playerid );
}
}
}
}
return 1;
}
Please help me!