Points giving rep -
iBots - 14.12.2013
i have tried to add points system to my script,code:
pawn Код:
//===============================[Points]=======================================
public CaptureTimer(point)
{
new string[128];
new fam;
if(Points[point][TimeToClaim])
{
new claimer = Points[point][ClaimerId];
new Float: x, Float: y, Float: z;
GetPlayerPos(claimer, x, y, z);
if (Points[point][Capturex] != x || Points[point][Capturey] != y || Points[point][Capturez] != z || GetPVarInt(Points[point][ClaimerId],"Injured") == 1)
{
SendClientMessage(Points[point][ClaimerId], COLOR_LIGHTBLUE, "You failed to capture. You either moved or died while attempting to capture.");
Points[point][ClaimerId] = INVALID_PLAYER_ID;
Points[point][TimeToClaim] = 0;
}
else
{
if(Points[point][Vulnerable] > 0)
{
SendClientMessage(Points[point][ClaimerId], COLOR_LIGHTBLUE, "You failed to capture. The point was already captured.");
Points[point][ClaimerId] = INVALID_PLAYER_ID;
Points[point][TimeToClaim] = 0;
return 1;
}
fam = PlayerInfo[claimer][pFMember];
format(string, sizeof(string), "%s has attempted to take control of the %s for %s, it will be theirs in %d minutes.", Points[point][PlayerNameCapping], Points[point][Name], FamilyInfo[fam][FamilyName]);
SendClientMessageToAll(COLOR_YELLOW, string);
if(Points[point][CaptureProccessEx] >= 1)
{
UpdateDynamic3DTextLabelText(Points[point][CaptureProccess], COLOR_YELLOW, string);
Points[point][CaptureProccessEx] = 2;
}
Points[point][TakeOverTimerStarted] = 1;
Points[point][TakeOverTimer] = 10;
Points[point][ClaimerId] = INVALID_PLAYER_ID;
Points[point][ClaimerTeam] = fam;
Points[point][TimeToClaim] = 0;
if(Points[point][CaptureTimerEx2] != -1) KillTimer(Points[point][CaptureTimerEx2]);
Points[point][CaptureTimerEx2] = SetTimerEx("CaptureTimerEx", 60000, 1, "d", point);
}
}
return 1;
}
//================================
public CaptureTimerEx(point)
{
new string[128];
new fam;
if (Points[point][TakeOverTimerStarted])
{
fam = Points[point][ClaimerTeam];
if (Points[point][TakeOverTimer] > 0)
{
Points[point][TakeOverTimer]--;
format(string, sizeof(string), "%s has successfully attempted to take over of %s for %s, it will be theirs in %d minutes!",
Points[point][PlayerNameCapping], Points[point][Name], FamilyInfo[fam][FamilyName], Points[point][TakeOverTimer]);
UpdateDynamic3DTextLabelText(Points[point][CaptureProccess], COLOR_YELLOW, string);
}
else
{
Points[point][ClaimerTeam] = INVALID_PLAYER_ID;
Points[point][TakeOverTimer] = 0;
Points[point][TakeOverTimerStarted] = 0;
Points[point][Announced] = 0;
Points[point][Vulnerable] = NEW_VULNERABLE;
DestroyDynamic3DTextLabel(Points[point][CaptureProccess]);
Points[point][CaptureProccessEx] = 0;
strmid(Points[point][Owner], FamilyInfo[fam][FamilyName], 0, 32, 32);
strmid(Points[point][CapperName], Points[point][PlayerNameCapping], 0, 32, 32);
format(string, sizeof(string), "%s has successfully taken control of the %s for %s.", Points[point][CapperName], Points[point][Name], Points[point][Owner]);
SendClientMessageToAll(COLOR_YELLOW, string);
UpdatePoints();
KillTimer(Points[point][CaptureTimerEx2]);
Points[point][CaptureTimerEx2] = -1;
}
}
}
public ProgressTimer(point)
{
if(Points[point][ClaimerId] != INVALID_PLAYER_ID && Points[point][TimeToClaim])
{
Points[point][TimeLeft]--;
SetProgressBarValue(Points[point][PointBarID], GetProgressBarValue(Points[point][PointBarID])-10.0);
UpdateProgressBar(Points[point][PointBarID], Points[point][ClaimerId]);
if(GetProgressBarValue(Points[point][PointBarID]) >= 10) SetTimerEx("ProgressTimer", 1000, 0, "d", point);
new string[128];
if(Points[point][TimeLeft] == 9) Points[point][CaptureProgress] = CreateDynamic3DTextLabel(string, COLOR_RED, Points[point][Pointx], Points[point][Pointy], Points[point][Pointz]+1.0, 10.0);
else if(Points[point][TimeLeft] < 9 && Points[point][TimeLeft] >= 0) UpdateDynamic3DTextLabelText(Points[point][CaptureProgress], COLOR_RED, string);
if(GetProgressBarValue(Points[point][PointBarID]) == 50.0)
{
SetProgressBarColor(Points[point][PointBarID], COLOR_YELLOW);
UpdateProgressBar(Points[point][PointBarID], Points[point][ClaimerId]);
}
else if(GetProgressBarValue(Points[point][PointBarID]) == 20.0)
{
SetProgressBarColor(Points[point][PointBarID], COLOR_RED);
UpdateProgressBar(Points[point][PointBarID], Points[point][ClaimerId]);
}
else if(GetProgressBarValue(Points[point][PointBarID]) <= 0.0 && Points[point][TimeLeft] <= 0)
{
CaptureTimer(point);
Points[point][TimeLeft] = 0;
DestroyProgressBar(Points[point][PointBarID]);
DestroyDynamic3DTextLabel(Points[point][CaptureProgress]);
}
}
else
{
DestroyProgressBar(Points[point][PointBarID]);
DestroyDynamic3DTextLabel(Points[point][CaptureProgress]);
Points[point][ClaimerId] = INVALID_PLAYER_ID;
Points[point][TimeToClaim] = 0;
}
return 1;
}
pawn Код:
public UpdatePoints()
{
new idx;
new File: file2;
while (idx < sizeof(Points))
{
new coordsstring[256];
format(coordsstring, sizeof(coordsstring), "%f|%f|%f|%d|%d|%s|%s|%s|%d\n",
Points[idx][Pointx],
Points[idx][Pointy],
Points[idx][Pointz],
Points[idx][Type],
Points[idx][Vulnerable],
Points[idx][Owner],
Points[idx][CapperName],
Points[idx][Name],
Points[idx][MatPoint]);
if(idx == 0)
{
file2 = fopen("points.cfg", io_write);
}
else
{
file2 = fopen("points.cfg", io_append);
}
fwrite(file2, coordsstring);
idx++;
fclose(file2);
}
return 1;
}
public LoadPoints()
{
new arrCoords[9][64];
new strFromFile2[256];
new File: file = fopen("points.cfg", io_read);
if (file)
{
new idx;
while (idx < sizeof(Points))
{
fread(file, strFromFile2);
split(strFromFile2, arrCoords, '|');
Points[idx][Pointx] = floatstr(arrCoords[0]);
Points[idx][Pointy] = floatstr(arrCoords[1]);
Points[idx][Pointz] = floatstr(arrCoords[2]);
Points[idx][Type] = strval(arrCoords[3]);
Points[idx][Vulnerable] = strval(arrCoords[4]);
strmid(Points[idx][Owner], arrCoords[5], 0, strlen(arrCoords[5]), 255);
strmid(Points[idx][CapperName], arrCoords[6], 0, strlen(arrCoords[6]), 255);
strmid(Points[idx][Name], arrCoords[7], 0, strlen(arrCoords[7]), 255);
Points[idx][MatPoint] = strval(arrCoords[8]);
//printf("%s Type:%d Owner:%s",Points[idx][Name],Points[idx][Type],Points[idx][Owner]);
Points[idx][CaptureTimerEx2] = -1;
Points[idx][ClaimerId] = INVALID_PLAYER_ID;
Points[idx][PointPickupID] = CreateDynamicPickup( 1239, 23, Points[idx][Pointx], Points[idx][Pointy], Points[idx][Pointz]);
idx++;
}
fclose(file);
}
return 1;
}
pawn Код:
if(strcmp(cmd,"/claim",true)==0)
{
new mypoint = -1;
if (PlayerInfo[playerid][pFMember] == 255 || PlayerInfo[playerid][pRank] < 5)
{
SendClientMessage(playerid, COLOR_GRAD1, " You are not high rank enough to capture!");
return 1;
}
for (new i=0; i<MAX_POINTS; i++)
{
if (IsPlayerInRangeOfPoint(playerid, 1.0, Points[i][Pointx], Points[i][Pointy], Points[i][Pointz])) mypoint = i;
}
if (mypoint == -1)
{
SendClientMessage(playerid, COLOR_GRAD1, " You are not at the capture place!");
return 1;
}
if (Points[mypoint][Vulnerable] > 0)
{
SendClientMessage(playerid, COLOR_GRAD1, " This point is not ready for takeover.");
return 1;
}
if (Points[mypoint][TimeToClaim])
{
SendClientMessage(playerid, COLOR_GRAD1, " This point is already being captured!");
return 1;
}
if(GetPlayerPing(playerid) > pointpinglimit)
{
format(string,sizeof(string), " You can not capture with %d+ ping!", pointpinglimit);
SendClientMessage(playerid, COLOR_WHITE, string);
return 1;
}
Points[mypoint][PointBarID] = CreateProgressBar(258.00, 137.00, 131.50, 3.19, COLOR_GREEN, 100.0);
SetProgressBarValue(Points[mypoint][PointBarID], 100.0);
ShowProgressBarForPlayer(playerid, Points[mypoint][PointBarID]);
GetPlayerPos(playerid, Points[mypoint][Capturex], Points[mypoint][Capturey], Points[mypoint][Capturez]);
Points[mypoint][ClaimerId] = playerid;
Points[mypoint][TimeToClaim] = 1;
Points[mypoint][TimeLeft] = 10;
SetTimerEx("ProgressTimer", 1000, 0, "d", mypoint);
return 1;
}
pawn Код:
if(strcmp(cmd,"/points",true)==0)
{
for(new i; i < MAX_POINTS; i++)
{
if (Points[i][Type] >= 0)
{
format(string, sizeof(string), "Name: %s | Owner: %s | Captured By: %s | Hours: %d",
Points[i][Name],Points[i][Owner],Points[i][CapperName],Points[i][Vulnerable]);
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
return 1;
}
and i have points.cfg in scriptfiles
and it not wrong,i mean the points.cfg,but when i do /points ig it shows:

and i cant claim at the entrance in points.cfg
Re: Points giving rep -
FahadKing07 - 14.12.2013
pawn Код:
if(strcmp(cmd,"/points",true)==0)
{
for(new i; i < MAX_POINTS; i++)
{
if (Points[i][Type] >= 0)
{
format(string, sizeof(string), "Name: %s | Owner: %s | Captured By: %s | Hours: %d",
Points[i][Name],Points[i][Owner],Points[i][CapperName],Points[i][Vulnerable]);
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
return 1;
}
You have problem with this CMD. Show me your /stats cmd, its very easy to solve it.
Re: Points giving rep -
iBots - 14.12.2013
pawn Код:
if(strcmp(cmd, "/stats", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid] != 0) ShowStats(playerid,playerid);
else SendClientMessage(playerid, COLOR_GRAD1, " You are not Logged in !");
}
return 1;
}
points details:
pawn Код:
enum fPInfo
{
Float:Pointx,
Float:Pointy,
Float:Pointz,
Type,
Vulnerable,
MatPoint,
CratePoint,
Announced,
ClaimerId,
ClaimerTeam,
TimeToClaim,
TimeLeft,
Owner[32],
PlayerNameCapping[MAX_PLAYER_NAME],
CapperName[MAX_PLAYER_NAME],
Name[32],
TakeOverTimerStarted,
TakeOverTimer,
Text3D:TextLabel,
CaptureTimerEx2,
Stock,
Text3D:CaptureProccess,
Text3D:CaptureProgress,
CaptureProccessEx,
Float: Capturex,
Float: Capturey,
Float: Capturez,
PointPickupID,
Bar:PointBarID,
PointBar,
}
new Points[MAX_POINTS][fPInfo];
stats:
pawn Код:
public ShowStats(playerid,targetid)
{
if(IsPlayerConnected(playerid)&&IsPlayerConnected(targetid))
{
new atext[20]; // Sex
new dtext[20]; // STD
new jtext[20]; // Job
new btext[40]; // Biz
new ctext[40]; // Vehicle 1
new ctext2[40]; // Vehicle 2
new jlevel[20]; // Job Level
new htext[40]; // House
switch (PlayerInfo[targetid][pSex])
{
case 0: atext = "None";
case 1: atext = "Male";
case 2: atext = "Female";
}
switch (STDPlayer[targetid])
{
case 0: dtext = "None";
case 1: dtext = "Chlamydia";
case 2: dtext = "Gonorrhea";
case 3: dtext = "Syphilis";
}
switch (PlayerInfo[targetid][pJob])
{
case 0: jtext = "None";
case 1: jtext = "Detective";
case 2: jtext = "Lawyer";
case 3: jtext = "Whore";
case 4: jtext = "Drug Dealer";
case 5: jtext = "Product Dealer";
case 7: jtext = "Mechanic";
case 8: jtext = "Bodyguard";
case 9: jtext = "Arms Dealer";
case 12: jtext = "Boxer";
case 14: jtext = "Taxi Driver";
case 17: jtext = "Drug Smuggler";
default: jtext = "None";
}
if(PlayerInfo[targetid][pJob] >= 0)
{
new level;
switch(PlayerInfo[targetid][pJob])
{
case 1: level = PlayerInfo[targetid][pDetSkill];
case 2: level = PlayerInfo[targetid][pLawSkill];
case 3: level = PlayerInfo[targetid][pSexSkill];
case 4: level = PlayerInfo[targetid][pDrugsSkill];
case 7: level = PlayerInfo[targetid][pJackSkill];
case 9: level = PlayerInfo[targetid][pArmsSkill];
case 12: level = PlayerInfo[targetid][pBoxSkill];
case 17: level = PlayerInfo[targetid][pSmugglerSkill];
case 0, 5, 8, 14: level = -1;
}
if(level >= 0 && level <= 49) jlevel = "1";
else if(level >= 50 && level <= 99) jlevel = "2";
else if(level >= 100 && level <= 199) jlevel = "3";
else if(level >= 200 && level <= 399) jlevel = "4";
else if(level >= 400) jlevel = "5";
else if(level == -1) jlevel = "None";
}
new married[20];
strmid(married, PlayerInfo[targetid][pMarriedTo], 0, strlen(PlayerInfo[targetid][pMarriedTo]), 255);
new ptime = PlayerInfo[targetid][pConnectTime];
new cash = PlayerInfo[targetid][pCash];
new deaths = PlayerInfo[targetid][pDeaths];
new pot = PlayerInfo[targetid][pPot];
new potseeds = PlayerInfo[targetid][pPotSeeds];
new crack = PlayerInfo[targetid][pCrack];
new packages = Packages[playerid];
new crates = Crates[playerid];
new matsa = PlayerInfo[targetid][pMatsA];
new matsb = PlayerInfo[targetid][pMatsB];
new matsc = PlayerInfo[targetid][pMatsC];
new spawn = PlayerInfo[targetid][pSpawn];
new rope = PlayerInfo[targetid][pRope];
new cigars = PlayerInfo[targetid][pCigars];
new sprunk = PlayerInfo[targetid][pSprunk];
new blindfolds = PlayerInfo[targetid][pBlindfolds];
new tikis = PlayerInfo[targetid][pTikis];
new spray = PlayerInfo[targetid][pSpraycan];
new crimes = PlayerInfo[targetid][pCrimes];
new arrested = PlayerInfo[targetid][pArrested];
new level = PlayerInfo[targetid][pLevel];
new exp = PlayerInfo[targetid][pExp];
new kills = PlayerInfo[targetid][pKills];
new pnumber = PlayerInfo[targetid][pPnumber];
new account = PlayerInfo[targetid][pAccount];
new nxtlevel = PlayerInfo[targetid][pLevel]+1;
new expamount = nxtlevel*levelexp;
new costlevel = nxtlevel*levelcost;
new housekey = PlayerInfo[targetid][pHouseLevel];
new intir = GetPlayerInterior(playerid);
new vw = GetPlayerVirtualWorld(targetid);
new skin = GetPlayerSkin(targetid);
new warns = PlayerInfo[targetid][pWarns];
new points = PlayerInfo[targetid][gPupgrade];
new jtime = PlayerInfo[targetid][pJailTime];
new deck = PlayerInfo[targetid][pDeck];
new wtc = PlayerInfo[targetid][pWTc];
new hticket = PlayerInfo[targetid][hTicket];
new products = PlayerInfo[targetid][pProducts];
new biz = PlayerInfo[targetid][pBizKey];
new carkey = PlayerInfo[targetid][CarLinkID];
new carkey2 = PlayerInfo[targetid][Car2LinkID];
new vehiclename[24];
new vehiclename2[24];
GetVehicleName(carkey, vehiclename, sizeof(vehiclename));
GetVehicleName(carkey2, vehiclename2, sizeof(vehiclename2));
//BIZ
if(biz != -1) { format(btext,sizeof(btext),"%s (%d)",BizInfo[biz][bName],biz); }
else { btext = "None"; }
//CAR 1
if(carkey != 0) { format(ctext,sizeof(ctext),"%s(%d)",vehiclename,carkey); }
else { ctext = "None"; }
//CAR 2
if(carkey2 != 0) { format(ctext2,sizeof(ctext2),"%s(%d)",vehiclename2,carkey2); }
else { ctext2 = "None"; }
//HOUSE
if(PlayerInfo[targetid][pHouseAccepted])
{
new location[MAX_ZONE_NAME];
Get2DZone(location, MAX_ZONE_NAME, PlayerInfo[targetid][pHouseX], PlayerInfo[targetid][pHouseY], PlayerInfo[targetid][pHouseZ]);
format(htext,sizeof(htext),"%s",location);
}
else { htext = "None"; }
//SCREW
new screw;
if(PlayerInfo[targetid][pScrew] > 0)
{
screw = 1;
}
new Float:health;
new Float:armor;
GetPlayerHealth(targetid,health);
GetPlayerArmour(targetid,armor);
new shealth = PlayerInfo[targetid][pSHealth];
new name[MAX_PLAYER_NAME];
GetPlayerName(targetid, name, sizeof(name));
new coordsstring[128];
SendClientMessage(playerid, COLOR_GREEN, "____________________________________________");
format(coordsstring, sizeof(coordsstring), "[Account]: Name:[%s] | Sex:[%s] | Level:[%d] | Respect:[%d/%d] | Phone:[%d] | WTc:[%d]",PlayerName(targetid),atext,level,exp,expamount,pnumber);
SendClientMessage(playerid, COLOR_GRAD1,coordsstring);
format(coordsstring, sizeof(coordsstring), "[Details]: Money:[$%d] | Bank:[$%d] | NextLevel:[%d] | Job:[%s (%s)] | Warnings:[%d] ",cash,account,costlevel,jtext,jlevel,warns);
SendClientMessage(playerid, COLOR_GRAD1,coordsstring);
format(coordsstring, sizeof(coordsstring), "[Details]: Spouse:[%s] | Affiliation:[%s] | Rank:[%s (%d)]",married,GetPlayerFactionName(targetid),GetPlayerRank(targetid),PlayerInfo[targetid][pRank]);
SendClientMessage(playerid, COLOR_GRAD2,coordsstring);
format(coordsstring, sizeof(coordsstring), "[Upgrades]: Points:[%d] | Armour:[%d] | Gunlocker:[%d]",points,shealth,PlayerInfo[targetid][hGL]);
SendClientMessage(playerid, COLOR_GRAD2,coordsstring);
format(coordsstring, sizeof(coordsstring), "[Property]: House:[%s] | Vehicle 1:[%s] | Vehicle 2:[%s] | Business:[%s]",htext,ctext,ctext2,btext);
SendClientMessage(playerid, COLOR_GRAD3,coordsstring);
format(coordsstring, sizeof(coordsstring), "[Inventory]: Materials:[%d] | Pot:[%d] | Crack:[%d] | Package:[%d] | Crates:[%d] | Seeds:[%d] | Products:[%d]",materials,pot,crack,packages,crates,potseeds,products);
SendClientMessage(playerid, COLOR_GRAD3,coordsstring);
format(coordsstring, sizeof(coordsstring), "[Inventory]: Ropes:[%d] | Blindfolds:[%d] | Cigars:[%d] | Sprunk:[%d] | Spraycan:[%d] | Screw Driver:[%d] | Cards:[%d]",rope,blindfolds,cigars,sprunk,spray,screw,deck,wtc);
SendClientMessage(playerid, COLOR_GRAD4,coordsstring);
format(coordsstring, sizeof(coordsstring), "[Records]: Playing Hours:[%d] | Kills:[%d] | Deaths:[%d] | Crimes:[%d] | Arrested:[%d]",ptime,kills,deaths,crimes,arrested);
SendClientMessage(playerid, COLOR_GRAD4,coordsstring);
if(PlayerInfo[playerid][pAdmin] >= 2)
{
format(coordsstring, sizeof(coordsstring), "[Admin Info]: HLevel: %d | HTicket: %d | Int: %d | VW: %d | JailTime: %d | Tikis: %d | Skin: %d",housekey,hticket,intir,vw,jtime,tikis,skin);
SendClientMessage(playerid, COLOR_GRAD5,coordsstring);
}
SendClientMessage(playerid, COLOR_GREEN, "____________________________________________");
}
}
Re: Points giving rep -
iFiras - 14.12.2013
nice hax <3 :P
Re: Points giving rep -
FahadKing07 - 14.12.2013
pawn Код:
if(strcmp(cmd,"/points",true)==0)
{
for(new i; i < MAX_POINTS; i++)
{
if (Points[i][Type] >= 0)
{
format(string, sizeof(string), "Name: %s | Owner: %s | Captured By: %s | Hours: %d",
PlayerName(targetid),PlayerName(playerid),PlayerName(playerid),ptime);///Mistake was here
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
return 1;
}
Re: Points giving rep -
iBots - 14.12.2013
Well the name is not for the player name its for the point name.... Point info...
And lol u just say nice hax?
Re: Points giving rep -
iBots - 14.12.2013
Bummmppppp
Re: Points giving rep -
iBots - 14.12.2013
Omg most of the guys say i am good at scripting,i put thread and i need help and i dont find anyone answering or even trying to
Re: Points giving rep -
iBots - 15.12.2013
BUMP
Re: Points giving rep -
iBots - 16.12.2013
helpppp