Do this work ?
#1

Could this work...@ home everybody sleeps
so can't testing >D....

I want to script that only One DrugDealer Is Allowed In my GunGame
and if another player wants to be a dealer he gets the message

We Already Have A DrugDealer...We don't need another more!

To that work ?

Код:
  if(strcmp("/ddealer",cmdtext,true) == 0)
  {
	GetPlayerName(playerid,name,sizeof(name));
	
	if(drugdealer[playerid] == 0)
  {
  drugdealer[playerid] = 1;
  SendClientMessage(playerid,COLOR_YELLOW,"What Up Thug...Get Some Drugs by Press /drughelp");
  }
  else if(drugdealer[playerid] >= 1)
  {
  drugdealer[playerid] = 0;
  SendClientMessage(playerid,COLOR_RED,"We Already Have A DrugDealer...We don't need another more!");
  }
  else
  {
  drugdealer[playerid] = 0;
  }
  return 1;
  }
Bearfist
Reply
#2

I think.. NO
Reply
#3

Very Helpful man!
...
could you say how I have to do it ?

Bearfist
Reply
#4

Quote:
Originally Posted by Bearfist
Very Helpful man!
tstststs
Quote:
Originally Posted by Bearfist
Could this work...@ home everybody sleeps
....
To that work ?
Short question = short answer!

Quote:
Originally Posted by Bearfist
could you say how I have to do it ?
now here you go \/ \/

pawn Код:
Top,
new drugdealer;

public OnGameModeInit()
{
    drugdealer=INVALID_PLAYER_ID;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
  if(strcmp("/ddealer",cmdtext,true) == 0)
  {
    if(drugdealer[playerid] == INVALID_PLAYER_ID)
        drugdealer=playerid,
        SendClientMessage(playerid,COLOR_YELLOW,"What Up Thug...Get Some Drugs by Press /drughelp");
    else
        SendClientMessage(playerid,COLOR_RED,"We Already Have A DrugDealer...We don't need another more!");
    return 1;
  }
}

Also,
public OnPlayerDisconnect(playerid, reason)
{
    if(playerid==drugdealer)
        drugdealer=INVALID_PLAYER_ID;
}
Reply
#5

Don't work =(

I got this errors:

(2410) : error 028: invalid subscript (not an array or too many subscripts): "drugdealer"
(2410) : warning 215: expression has no effect
(2410) : error 001: expected token: ";", but found "]"
(2410) : error 029: invalid expression, assumed zero

in these line:
Код:
 if(drugdealer[playerid] == INVALID_PLAYER_ID)
In this function:
Код:
if(strcmp("/dd",cmdtext,true) == 0)
  {
  if(drugdealer[playerid] == INVALID_PLAYER_ID)
  drugdealer=playerid;
  SendClientMessage(playerid,COLOR_YELLOW,"What Up Thug...Get Some Drugs by Press /drughelp");
  else
  SendClientMessage(playerid,COLOR_RED,"We Already Have A DrugDealer...We don't need Another One!");
	return 1;
  }
Why doesn't it want to work ? ...

Bearfist
Reply
#6

Quote:
Originally Posted by Bearfist
I got this errors:
in these line:
Код:
 if(drugdealer[playerid] == INVALID_PLAYER_ID)
yup, my bad

change it to :
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  if(strcmp("/ddealer",cmdtext,true) == 0)
  {
    if(drugdealer == INVALID_PLAYER_ID)
        drugdealer=playerid,
        SendClientMessage(playerid,COLOR_YELLOW,"What Up Thug...Get Some Drugs by Press /drughelp");
    else
        SendClientMessage(playerid,COLOR_RED,"We Already Have A DrugDealer...We don't need another more!");
    return 1;
  }
}
Reply
#7

That solution will make playerid 0 as default drugdealer, it would be better to set the variable -1 as default.
Reply
#8

That Worked ...
But when I set drugdealer to 0 I can't make me to drugdealer more o.O

...whatever
it don't matter ..isn't sooo important ! xD

But Thanks All =)

Bearfist
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)