Points System
#1

Hi there. In my script I have something that announces when points will start, but no capture signs appear at points.

How can I implant this?

Any help is appreciated. Thanks
Reply
#2

SetPlayerCheckpoint

EDIT: Looking at the post below... What do you mean as we are both talking about differnt things.

^^ I think... Have I got the wrong end of the stick?
Reply
#3

What gamemode you are using ? and show us your point system and the announces when points starting.
Reply
#4

@IceCube, I'm a scripting beginner so please tell me what exactly I shall do :P

SetPlayerCheckpoint(Interior ID) ?

@WoodPecker, A private one. I don't have a points system but here's everything related to points in ma script

Quote:

new CapturePosition[MAX_PLAYERS][CapPointPos];

Quote:

enum cInfo
{
PointTaken,
PointName[20],
PointOwner[32],
PointCapturer[MAX_PLAYER_NAME],
PointTime,
};

Quote:

public ClearPoint(point)
{
new string[MAX_PLAYER_NAME];
format(string, sizeof(string), "None");
PointInfo[point][PointTaken] = 255;
strmid(PointInfo[point][PointOwner], string, 0, strlen(string), 255);
strmid(PointInfo[point][PointCapturer], string, 0, strlen(string), 255);
SavePoints();
return 1;
}

Quote:

if(pickupid == iPoint1 || pickupid == iPoint2 || pickupid == iPoint3 || pickupid == iPoint4 || pickupid == iPoint5)
{
GameTextForPlayer(playerid, "Type ~r~/capture to capture the point", 1000, 5);
return 1;
}

Quote:

public LoadPoints()
{
new arrCoords[5][64];
new strFromFile2[256];
new File: file = fopen("points.cfg", io_read);
if(file)
{
new idx;
while (idx < sizeof(PointInfo))
{
fread(file, strFromFile2);
split(strFromFile2, arrCoords, '|');
PointInfo[idx][PointTaken] = strvalEx(arrCoords[0]);
strmid(PointInfo[idx][PointName], arrCoords[1], 0, strlen(arrCoords[1]), 255);
strmid(PointInfo[idx][PointOwner], arrCoords[2], 0, strlen(arrCoords[2]), 255);
strmid(PointInfo[idx][PointCapturer], arrCoords[3], 0, strlen(arrCoords[3]), 255);
PointInfo[idx][PointTime] = strvalEx(arrCoords[4]);
printf("Point:%d Taken:%d Name:%s Owner:%s Captured by:%s Time:%d",idx,PointInfo[idx][PointTaken],PointInfo[idx][PointName],PointInfo[idx][PointOwner],PointInfo[idx][PointCapturer],PointInfo[idx][PointTime]);
idx++;
}
fclose(file);
}
return 1;
}

public SavePoints()
{
new idx;
new File: file2;
while (idx < sizeof(PointInfo))
{
new coordsstring[256];
format(coordsstring, sizeof(coordsstring), "%d|%s|%s|%s|%d\n",
PointInfo[idx][PointTaken],
PointInfo[idx][PointName],
PointInfo[idx][PointOwner],
PointInfo[idx][PointCapturer],
PointInfo[idx][PointTime]);
if(idx == 0)
{
file2 = fopen("points.cfg", io_write);
}
else
{
file2 = fopen("points.cfg", io_append);
}
fwrite(file2, coordsstring);
idx++;
fclose(file2);
}
return 1;
}

Quote:

public PointCheck()
{
new string[128];
for(new p = 0; p < sizeof(PointInfo); p++)
{
if(PointInfo[p][PointTime] == 0)
{
format(string, sizeof(string), "The {00F200}%s{FFFF00} has become available to capture.",PointInfo[p][PointName]);
SendClientMessageToAll(COLOR_YELLOW, string);
PointInfo[p][PointTaken] = 255;
AnnouncePoint();
}
}
return 1;
}

public AnnouncePoint()
{
return 1;
}

Quote:

if(strcmp(cmd, "/points", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new number = 0;
SendClientMessage(playerid, COLOR_GREEN,"_____________________________________ __");
for(new i = 0; i < sizeof(PointInfo); i++)
{
number ++;
format(string, sizeof(string), "Name: %s | Owner: %s | Captured by: %s | Hours: %d",PointInfo[i][PointName],PointInfo[i][PointOwner],PointInfo[i][PointCapturer],PointInfo[i][PointTime]);
SendClientMessage(playerid, COLOR_GRAD6, string);
}
SendClientMessage(playerid, COLOR_GREEN,"_____________________________________ __");
return 1;
}
return 1;
}

Quote:

if(strcmp(cmd, "/capture", true) == 0 || strcmp(cmd, "/claim", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pFMember] == 255)
{
SendClientMessage(playerid, COLOR_GREY, " You are not a member of a Family !");
return 1;
}
if(PlayerInfo[playerid][pRank] < 5)
{
SendClientMessage(playerid, COLOR_GREY, " You must be at least rank 5 to capture !");
return 1;
}
if(IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid, COLOR_GREY, " You can't capture while in a vehicle !");
return 1;
}
if(CapturingTimer[playerid]) return SendClientMessage(playerid,COLOR_GREY," You must wait 10 seconds before attempting to capture again !");
if(IsPlayerInRangeOfPoint(playerid,1.0,2629.4319,-2107.8040,16.9531)) //fossil fuel
{
if(PointInfo[0][PointTaken] != 255) { SendClientMessage(playerid, COLOR_GREY, " That isn't available to capture yet !"); return 1; }
GetPlayerName(playerid, sendername, sizeof(sendername));
GetPlayerPos(playerid, CapturePosition[playerid][pX], CapturePosition[playerid][pY], CapturePosition[playerid][pZ]);
format(string, sizeof(string), "%s is attempting to capture the materials factory 1 !", sendername,PointInfo[3][PointName]);
ProxDetector(50.0, playerid, string, COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED) ;
PointCapturable = 3;
CapturingTimer[playerid] = true;
SetTimerEx("CapturingPoint",10*1000,0,"i",playerid );
}
else if(IsPlayerInRangeOfPoint(playerid,1.0,1423.6151,-1320.5437,13.5547)) //materials pickup 1
{
if(PointInfo[1][PointTaken] != 255) { SendClientMessage(playerid, COLOR_GREY, " That isn't available to capture yet !"); return 1; }
GetPlayerName(playerid, sendername, sizeof(sendername));
GetPlayerPos(playerid, CapturePosition[playerid][pX], CapturePosition[playerid][pY], CapturePosition[playerid][pZ]);
format(string, sizeof(string), "%s is attempting to capture the materials pickup 1 !", sendername,PointInfo[1][PointName]);
ProxDetector(50.0, playerid, string, COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED) ;
PointCapturable = 1;
CapturingTimer[playerid] = true;
SetTimerEx("CapturingPoint",10*1000,0,"i",playerid );
}
/*else if(IsPlayerInRangeOfPoint(playerid,1.0,2205.9199,1 582.2222,999.9766)) //drug factory
{
if(PointInfo[2][PointTaken] != 255) { SendClientMessage(playerid, COLOR_GREY, " That isn't available to capture yet !"); return 1; }
GetPlayerName(playerid, sendername, sizeof(sendername));
GetPlayerPos(playerid, CapturePosition[playerid][pX], CapturePosition[playerid][pY], CapturePosition[playerid][pZ]);
format(string, sizeof(string), "%s is attempting to capture the drug factory !", sendername,PointInfo[2][PointName]);
ProxDetector(50.0, playerid, string, COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED) ;
PointCapturable = 2;
CapturingTimer[playerid] = true;
SetTimerEx("CapturingPoint",10*1000,0,"i",playerid );
}
else if(IsPlayerInRangeOfPoint(playerid,1.0,2172.1880,-2263.9683,13.3363)) //materials factory 1
{
if(PointInfo[3][PointTaken] != 255) { SendClientMessage(playerid, COLOR_GREY, " That isn't available to capture yet !"); return 1; }
GetPlayerName(playerid, sendername, sizeof(sendername));
GetPlayerPos(playerid, CapturePosition[playerid][pX], CapturePosition[playerid][pY], CapturePosition[playerid][pZ]);
format(string, sizeof(string), "%s is attempting to capture the materials factory 1 !", sendername,PointInfo[3][PointName]);
ProxDetector(50.0, playerid, string, COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED) ;
PointCapturable = 3;
CapturingTimer[playerid] = true;
SetTimerEx("CapturingPoint",10*1000,0,"i",playerid );
}
else if(IsPlayerInRangeOfPoint(playerid,1.0,2729.9077,-2451.4514,17.5937)) //auto export
{
if(PointInfo[4][PointTaken] != 255) { SendClientMessage(playerid, COLOR_GREY, " That isn't available to capture yet !"); return 1; }
GetPlayerName(playerid, sendername, sizeof(sendername));
GetPlayerPos(playerid, CapturePosition[playerid][pX], CapturePosition[playerid][pY], CapturePosition[playerid][pZ]);
format(string, sizeof(string), "%s is attempting to capture the auto export company !", sendername,PointInfo[4][PointName]);
ProxDetector(50.0, playerid, string, COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED) ;
PointCapturable = 4;
CapturingTimer[playerid] = true;
SetTimerEx("CapturingPoint",10*1000,0,"i",playerid );
}
else if(IsPlayerInRangeOfPoint(playerid,1.0,323.0342,11 18.5804,1083.882) //drug house
{
if(PointInfo[5][PointTaken] != 255) { SendClientMessage(playerid, COLOR_GREY, " That isn't available to capture yet !"); return 1; }
GetPlayerName(playerid, sendername, sizeof(sendername));
GetPlayerPos(playerid, CapturePosition[playerid][pX], CapturePosition[playerid][pY], CapturePosition[playerid][pZ]);
format(string, sizeof(string), "%s is attempting to capture the drug house !", sendername,PointInfo[5][PointName]);
ProxDetector(50.0, playerid, string, COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED) ;
PointCapturable = 5;
CapturingTimer[playerid] = true;
SetTimerEx("CapturingPoint",10*1000,0,"i",playerid );
} */
else if(IsPlayerInRangeOfPoint(playerid,1.0,2390.4053,-2008.2618,13.5537)) //materials pickup 2
{
if(PointInfo[2][PointTaken] != 255) { SendClientMessage(playerid, COLOR_GREY, " That isn't available to capture yet !"); return 1; }
GetPlayerName(playerid, sendername, sizeof(sendername));
GetPlayerPos(playerid, CapturePosition[playerid][pX], CapturePosition[playerid][pY], CapturePosition[playerid][pZ]);
format(string, sizeof(string), "%s is attempting to capture the materials pickup 2 !", sendername,PointInfo[6][PointName]);
ProxDetector(50.0, playerid, string, COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED) ;
PointCapturable = 6;
CapturingTimer[playerid] = true;
SetTimerEx("CapturingPoint",10*1000,0,"i",playerid );
}
else if(IsPlayerInRangeOfPoint(playerid,1.0,2346.2937,-1185.2551,1027.9766)) //crack lab
{
if(PointInfo[3][PointTaken] != 255) { SendClientMessage(playerid, COLOR_GREY, " That isn't available to capture yet !"); return 1; }
GetPlayerName(playerid, sendername, sizeof(sendername));
GetPlayerPos(playerid, CapturePosition[playerid][pX], CapturePosition[playerid][pY], CapturePosition[playerid][pZ]);
format(string, sizeof(string), "%s is attempting to capture the crack lab !", sendername,PointInfo[3][PointName]);
ProxDetector(50.0, playerid, string, COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED) ;
PointCapturable = 7;
CapturingTimer[playerid] = true;
SetTimerEx("CapturingPoint",10*1000,0,"i",playerid );
}
else if(IsPlayerInRangeOfPoint(playerid,1.0,2288.0730,-1105.4535,37.9766)) //materials factory 2
{
if(PointInfo[4][PointTaken] != 255) { SendClientMessage(playerid, COLOR_GREY, " That isn't available to capture yet !"); return 1; }
GetPlayerName(playerid, sendername, sizeof(sendername));
GetPlayerPos(playerid, CapturePosition[playerid][pX], CapturePosition[playerid][pY], CapturePosition[playerid][pZ]);
format(string, sizeof(string), "%s is attempting to capture the materials factory 2 !", sendername,PointInfo[4][PointName]);
ProxDetector(50.0, playerid, string, COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED) ;
PointCapturable = 8;
CapturingTimer[playerid] = true;
SetTimerEx("CapturingPoint",10*1000,0,"i",playerid );
}
/*else if(IsPlayerInRangeOfPoint(playerid,1.0,1324.2122,2 86.5997,20.0452)) //sprunk factory MF1 MF2 MP1 MP2 and Crack Lab
{
if(PointInfo[9][PointTaken] != 255) { SendClientMessage(playerid, COLOR_GREY, " That isn't available to capture yet !"); return 1; }
GetPlayerName(playerid, sendername, sizeof(sendername));
GetPlayerPos(playerid, CapturePosition[playerid][pX], CapturePosition[playerid][pY], CapturePosition[playerid][pZ]);
format(string, sizeof(string), "%s is attempting to capture the sprunk factory !", sendername,PointInfo[9][PointName]);
ProxDetector(50.0, playerid, string, COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED) ;
PointCapturable = 9;
CapturingTimer[playerid] = true;
SetTimerEx("CapturingPoint",10*1000,0,"i",playerid );
}*/
else
{
SendClientMessage(playerid, COLOR_GREY," You are not at the capture point !");
}
}
return 1;
}

Quote:

public CapturingPoint(playerid)
{
if(!IsPlayerConnected(playerid)) return 0;
if(CapturingTimer[playerid] == 1 && PointCapturable != 255 && PlayerInfo[playerid][pFMember] != 255)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
if(CapturePosition[playerid][pX] == X && CapturePosition[playerid][pY] == Y && CapturePosition[playerid][pZ] == Z)
{
new string[128];
new sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "%s has attempted to take control of the %s for %s.", sendername,PointInfo[PointCapturable][PointName],FamilyInfo[PlayerInfo[playerid][pFMember]][FamilyName]);
SendClientMessageToAll(COLOR_YELLOW, string);
CapturingTimer[playerid] = 0;
CapturingName = sendername;
CapturingFamily = PlayerInfo[playerid][pFMember];
KillTimer(claimedtimer);
claimedtimer = SetTimer("ClaimedPoint", 600*1000, 0); //10 minutes
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You have moved from the capture position!");
CapturingTimer[playerid] = 0;
}
}
return 1;
}

Quote:

public ClaimedPoint()
{
if(PointCapturable != 255)
{
new string[128];
format(string, sizeof(string), "%s has sucessfully taken control of the %s for %s.", CapturingName,PointInfo[PointCapturable][PointName],FamilyInfo[CapturingFamily][FamilyName]);
SendClientMessageToAll(COLOR_YELLOW, string);
PointInfo[PointCapturable][PointTaken] = CapturingFamily; //fixed
format(string, sizeof(string), "%s", FamilyInfo[CapturingFamily][FamilyName]);
strmid(PointInfo[PointCapturable][PointOwner], string, 0, strlen(string), 255);
PointInfo[PointCapturable][PointCapturer] = CapturingName;
PointInfo[PointCapturable][PointTime] = 24;
PointCapturable = 255;
CapturingFamily = 255;
RemovePointCheckpoint();
SavePoints();
}
return 1;
}

RemovePointCheckpoint()
{
for(new p = 0; p < MAX_PLAYERS; p++)
{
if(IsPlayerConnected(p))
{
if(PlayerInfo[p][pFMember] != 255 && CP[p] == 4)
{
CP[p] = 0; DisablePlayerCheckpoint(p);
}
}
}
return 1;
}

Reply
#5

This may help..

https://sampwiki.blast.hk/wiki/Function:SetPlayerCheckpoint < Posted so you maybe can use this to help you in the future

pawn Код:
SetPlayerCheckpoint(playerid, x, y, z, size);
Reply
#6

He is using US-RP / SA-RP / P-RP edit.. add points.cfg file to your scriptfiles folder
Reply
#7

@Breto, points.cfg is already there
@IceCube, K I'll try
Reply
#8

Actually I don't understand this command

I saw this and it seems confusing

Also please notice that some capturing points are working, but not all

Quote:

if(response)
{
if(listitem == 0) // Vehicle 1
{
if(PlayerInfo[playerid][PlayerCarModel] > 0)
{
if(CP[playerid] == 0)
{
new Float: CurCarX, Float: CurCarY, Float: CurCarZ;
GetVehiclePos(PlayerInfo[playerid][CarLinkID], CurCarX, CurCarY, CurCarZ);
SetPlayerCheckpoint(playerid, CurCarX, CurCarY, CurCarZ, 10.0);
CP[playerid] = 112221;
SendClientMessage(playerid, COLOR_WHITE, "A checkpoint has been set. If you can't reach it, please type the command again!");
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "You already have an active checkpoint, please reach it first.");
}
}
}

Reply
#9

Can you Specify the Problem ? the Checkpoint don't appear on Radar or what exactly happens wrong
Reply
#10

EDIT@ As said above
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)