[Welp] How to make a /command when u type it again disable/remove something.
#1

Ok so i managed to work out how to attach a object to a players head etc. but i want to know how can i make it so if i type the command again it would remove it.

Код:
	if(strcmp(cmd, "/tv", true) == 0) {
		SendPlayerFormattedText(playerid,"You Now Are A TV Head!!.",0);
		new tv;
  		tv = 1518;
		SetPlayerHoldingObject(playerid, tv, 2, 0000.23, 0000.0, 0000.0, 0000.0, 0085.0, 0180.0);
    return 1;
	}
Reply
#2

i think this wont work but try
Код:
if(strcmp(cmd, "/tv", true) == 0) {
    if(IsPlayerHoldingObject[playerid] == 0)     {
    IsPlayerHoldingObject[playerid] == 1
    SendPlayerFormattedText(playerid,"You Now Are A TV Head!!.",0);
    new tv;
    tv = 1518;
    SetPlayerHoldingObject(playerid, tv, 2, 0000.23, 0000.0, 0000.0, 0000.0, 0085.0, 0180.0);
    } else {
    if(IsPlayerHoldingObject[playerid] == 0)     { StopPlayerHoldingObject(playerid);
    SendPlayerFormattedText(playerid,"You Now Are Not Anymore TV Head!!.",0);
        }
    return 1;
}

//and on top of script new IsPlayerHoldingObject[MAX_PLAYERS];
Reply
#3

Quote:
Originally Posted by oттo
Посмотреть сообщение
i think this wont work but try
Код:
if(strcmp(cmd, "/tv", true) == 0) {
    if(IsPlayerHoldingObject[playerid] == 0)     {
    IsPlayerHoldingObject[playerid] == 1
    SendPlayerFormattedText(playerid,"You Now Are A TV Head!!.",0);
    new tv;
    tv = 1518;
    SetPlayerHoldingObject(playerid, tv, 2, 0000.23, 0000.0, 0000.0, 0000.0, 0085.0, 0180.0);
    } else {
    if(IsPlayerHoldingObject[playerid] == 0)     { StopPlayerHoldingObject(playerid);
    SendPlayerFormattedText(playerid,"You Now Are Not Anymore TV Head!!.",0);
        }
    return 1;
}

//and on top of script new IsPlayerHoldingObject[MAX_PLAYERS];
thanks , i will try it tomorrow morning.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)