[HELP]Luck Sustem
#1

How i can make my gamemode gives to a player 1 item 50 % 2 items 30% and 3 items 20 %

Код:
if (strcmp(cmdtext, "/tabaco", true)==0)
	{
		AddItemToPlayerInventory(playerid,1,1,"Item");
		SendClientMessage(playerid,COLOR_GREEN,"You Find 1 Tabaco Leaf");
		AddItemToPlayerInventory(playerid,1,2,"Item");
		SendClientMessage(playerid,COLOR_GREEN,"You Find 2 Tabaco Leaf");
		AddItemToPlayerInventory(playerid,1,3,"Item");
		SendClientMessage(playerid,COLOR_GREEN,"You Find 1 Tabaco Leaf");
		return 1;
	}
Reply
#2

In your best interest I have put a timer on it and an anti-spam function.

pawn Код:
#define FindTobacoTime 5000 //Time in milliseconds it takes to find tobaco
forward ProcessTobacoFind(playerid);
pLastTobacoFind[MAX_PLAYERS];
pSpamalot[MAX_PLAYERS];
Float:pLastStand[MAX_PLAYERS][3];
public OnPlayerConnect(playerid)
{
  pLastTobacoFind[playerid]=gettick();
  return 1;
}
public OnPlayerCommandText(playerid,cmdtext[])
{
  if(!strcmp(cmdtext[1],"tobaco",true))
  {
    pSpamalot[playerid]++;
    if(pSpamalot[playerid]>5)
    {
      pLastTobacoFind[playerid]=gettick()+3600000; //3600000 MS = 1 hour, you should probably change this.
      pSpamalot[playerid]=0;
      SendClientMessage(playerid,0xFF0000FF,"You have spammed, you're banned from this command for 1 hour");
      return SendClientMessage(playerid,0xFF0000FF,"Typing the command in more will just make you wait longer.");
    }
    if(pLastTobacoFind[playerid]>gettick()) return SendClientMessage(playerid,0xFF0000FF,"You cannot do that yet!");
    pSpamalot[playerid]=0;
    SetTimerEx("ProcessTobacoFind",FindTobacoTime,0,"i",playerid);
    pLastTobacoFind[playerid]=gettick();
    GetPlayerPos(playerid,pLastStand[playerid][0],pLastStand[playerid][1],pLastStand[playerid][2]);
    SendClientMessage(playerid,0xFF0000FF,"You have started looking for tobaco leaves.");
    return SendClientMessage(playerid,0xFF0000FF,"If you move, you won't find any.");
  }
  return 0;
}
public ProcessTobacoFind(playerid)
{
  if(IsPlayerInRangeOfPoint(playerid,pLastStand[0],pLastStand[1],pLastStand[2])>0)return SendClientMessage(playerid,0xFF0000FF,"You didn't find any tobaco leaves.");
  new temp = random(100);
  new find;
  if(temp<33)return SendClientMessage(playerid,0xFF0000FF,"You didn't find any tobaco leaves."); //33% chance of failure
  else if(temp<70)find = 1; //37% chance to find only 1
  else if(temp<90)find = 2; //20% chance to find 2
  else find = 3; //10% chance to find 3
  new tmpstring[100];
  format(tmpstring,sizeof(tmpstring),"You have found %d leave(s).",find);
  AddItemToPlayerInventory(playerid,1,find,"Item");//This is YOUR function, not sure how to use it
  return SendClientMessage(playerid,0xFF0000FF,tmpstring);
}
Reply
#3

Код:
C:\Users\Giwtis\Desktop\samp03asvr_R\gamemodes\thewest.pwn(416) : error 017: undefined symbol "gettick"
C:\Users\Giwtis\Desktop\samp03asvr_R\gamemodes\thewest.pwn(421) : error 017: undefined symbol "gettick"
C:\Users\Giwtis\Desktop\samp03asvr_R\gamemodes\thewest.pwn(424) : error 017: undefined symbol "gettick"
C:\Users\Giwtis\Desktop\samp03asvr_R\gamemodes\thewest.pwn(1249) : error 035: argument type mismatch (argument 2)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
how i can fix it
Reply
#4

replace it with
pawn Код:
GetTickCount()
And what line is (1249) ?
Reply
#5

Код:
1248. if(IsPlayerInRangeOfPoint(playerid,pLastStand[0],pLastStand[1],pLastStand[2])>0)return SendClientMessage(playerid,0xFF0000FF,"You didn't find any tobaco leaves.");
this
Reply
#6

how i can fix it
Reply
#7

Change this
pawn Код:
if(IsPlayerInRangeOfPoint(playerid,pLastStand[0],pLastStand[1],pLastStand[2])>0)
To this
pawn Код:
if(!IsPlayerInRangeOfPoint(playerid,0.0,pLastStand[0],pLastStand[1],pLastStand[2]))
Reply
#8

Sustem = System.
Reply
#9

Код:
C:\Users\Giwtis\Desktop\samp03asvr_R\gamemodes\thewest.pwn(1248) : error 035: argument type mismatch (argument 3)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
i change it but again problem
Reply
#10

pawn Код:
if(!(IsPlayerInRangeOfPoint(playerid,0.0,pLastStand[0],pLastStand[1],pLastStand[2])))
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)