SA-MP Forums Archive
[HELP]Luck Sustem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP]Luck Sustem (/showthread.php?tid=120859)



[HELP]Luck Sustem - Giotis11 - 13.01.2010

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;
	}



Re: [HELP]Luck Sustem - Joe Staff - 13.01.2010

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);
}



Re: [HELP]Luck Sustem - Giotis11 - 13.01.2010

Код:
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


Re: [HELP]Luck Sustem - Joe Staff - 13.01.2010

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


Re: [HELP]Luck Sustem - Giotis11 - 14.01.2010

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


Re: [HELP]Luck Sustem - Giotis11 - 14.01.2010

how i can fix it



Re: [HELP]Luck Sustem - Joe Staff - 14.01.2010

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]))



Re: [HELP]Luck Sustem - Retardedwolf - 14.01.2010

Sustem = System.


Re: [HELP]Luck Sustem - Giotis11 - 15.01.2010

Код:
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


Re: [HELP]Luck Sustem - wiilweer - 15.01.2010

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