Problem Help Please [+REP For Helper] - 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)
+--- Thread: Problem Help Please [+REP For Helper] (
/showthread.php?tid=660971)
Problem Help Please [+REP For Helper] -
PoniStar - 18.11.2018
hi guys so i was working on my Familly System , so i want to if the clan slots are full no one can create familly anymore , here is my code :
Код:
#define MAX_FAMS 5
new fid;
for(new i=0; i != MAX_FAMS; i++)
{
if(FamStat[i][FamName]) { continue; } else
{
fid = i;
break;
}
}
if(fid > MAX_GANGS) return SendClientMessage(playerid, 0xffffffff, "No More Empty Slot , Try Again Later");
so , if a familly has name it will go to next one and it should work like this : if there was a empty slot (no name = empty) fid = i; (i will use fid for the familly id) but now, even if it is not empty, it will be replaced by familly who has 0 ID ! i mean it will replace with the first fam
can you please edit this code along with an explanation ? thnx guys !
Re: Problem Help Please [+REP For Helper] -
ReD_HunTeR - 18.11.2018
pawn Код:
#define isnull(%1) ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1])))) //we will use this to check if famname is empty
#define MAX_FAMS 5
new fid = -1; //lets assume "fid" "-1" because we cannot use 0 as it is already a slot for ur family
for(new i = 0; i != MAX_FAMS; i++) //loop
{
if(isnull(FamStat[i][FamName])) //this is how we are gonna find out if there is a family with empty name
{
fid = i; //changing "fid" variable to fetched id
break; //breaking the loop
}
}
if(fid == -1) return SendClientMessage(playerid, 0xffffffff, "No More Empty Slot , Try Again Later"); //if fid is still -1 it means that there were no slot found otherwise it would have fetched an id between 1-5
try this.
Re: Problem Help Please [+REP For Helper] -
PoniStar - 18.11.2018
I did not try it, but I did it with a general change in the construction of the family, on create family , anyway thnx for your help +reped