native SetPlayerCheckpoint(playerid, Float:x, Float:y, Float:z, Float:size, cp_id = UNUSED_CHECKPOINT_ID);
native DisablePlayerCheckpoint(playerid);
native IsValidCheckpoint(playerid);
native GetPlayerCheckpointId(playerid);
native GetPlayerCheckpointPos(playerid, &Float:x, &Float:y, &Float:z);
native GetPlayerCheckpointSize(playerid, &Float:size);
native IsPlayerInRangeOfCheckpoint(playerid, Float:range);
native Float:GetPlayerDistanceFromCheckpoint(playerid);
// Added in version 1.2.0, will not work in earlier versions.
native SetPlayerRaceCheckpoint(playerid, type, Float:x, Float:y, Float:z, Float:nextx, Float:nexty, Float:nextz, Float:size, cp_id = UNUSED_CHECKPOINT_ID);
native DisablePlayerRaceCheckpoint(playerid);
native IsValidRaceCheckpoint(playerid);
native GetPlayerRaceCheckpointId(playerid);
native GetPlayerRaceCheckpointPos(playerid, &Float:x, &Float:y, &Float:z);
native GetPlayerRaceCheckpointNextPos(playerid, &Float:nextx, &Float:nexty, &Float:nextz);
native GetPlayerRaceCheckpointSize(playerid, &Float:size);
native IsPlayerInRangeOfRaceCheckpoint(playerid, Float:range);
native Float:GetDistanceFromRaceCheckpoint(playerid);
// Added in version 1.1.0, will not work in earlier versions.
native OnPlayerCheckpointSet(playerid);
native OnPlayerCheckpointDisable(playerid);
// Added in version 1.2.0, will not work in earlier versions.
native OnPlayerRaceCheckpointSet(playerid);
native OnPlayerRaceCheckpointDisable(playerid);
native OnPlayerConnect(playerid);
native OnPlayerEnterCheckpoint(playerid);
native OnPlayerLeaveCheckpoint(playerid);
// Added in version 1.2.0.
native OnPlayerEnterRaceCheckpoint(playerid);
native OnPlayerLeaveRaceCheckpoint(playerid);
#define FILTERSCRIPT
#include <a_samp>
#undef MAX_PLAYERS
#define MAX_PLAYERS 50
#include <izcmd>
#include <checkpoint>
#define CHECKPOINT_OLD_1 0
#define CHECKPOINT_OLD_2 1
enum {
CHECKPOINT_UNUSED,
CHECKPOINT_DEAGLE,
CHECKPOINT_M4,
CHECKPOINT_CASH
};
new playerCheckpoint[MAX_PLAYERS] = {-1, ...};
public OnFilterScriptInit() {
print("Checkpoint:Example script initialized.");
for(new i = GetPlayerPoolSize(); i != -1; i--) {
if(!IsPlayerConnected(i) || IsPlayerNPC(i))
continue;
OnPlayerConnect(i);
}
return 1;
}
public OnFilterScriptExit() {
print("Checkpoint: Example script exited.");
for(new i = GetPlayerPoolSize(); i != -1; i--) {
if(!IsPlayerConnected(i) || IsPlayerNPC(i))
continue;
OnPlayerDisconnect(i, -1);
}
return 1;
}
public OnPlayerConnect(playerid) {
SendClientMessage(playerid, -1, "{1E90FF}Checkpoint:{BEBEBE} Welcome, this server is running the example script.");
playerCheckpoint[playerid] = -1;
return 1;
}
public OnPlayerDisconnect(playerid, reason) {
SendClientMessage(playerid, -1, "{1E90FF}Checkpoint:{BEBEBE} Bye, see you later.");
DisablePlayerCheckpoint(playerid);
return 1;
}
CMD:oldcp1(playerid, params[]) {
if(!SetPlayerCheckpoint(playerid, 5.0000, 5.0000, 2.0000, 5))
return SendClientMessage(playerid, -1, "{1E90FF}Checkpoint:{BEBEBE} Error, could not set the checkpoint.");
playerCheckpoint[playerid] = CHECKPOINT_OLD_1;
return CMD_SUCCESS;
}
CMD:oldcp2(playerid, params[]) {
if(!SetPlayerCheckpoint(playerid, 0.0000, 0.0000, 2.0000, 5))
return SendClientMessage(playerid, -1, "{1E90FF}Checkpoint:{BEBEBE} Error, could not set the checkpoint.");
playerCheckpoint[playerid] = CHECKPOINT_OLD_2;
return CMD_SUCCESS;
}
CMD:deagle(playerid, params[]) {
if(!SetPlayerCheckpoint(playerid, 20.0000, 20.0000, 2.0000, 5, CHECKPOINT_DEAGLE))
return SendClientMessage(playerid, -1, "{1E90FF}Checkpoint:{BEBEBE} Error, could not set the checkpoint.");
return CMD_SUCCESS;
}
CMD:m4(playerid, params[]) {
if(!SetPlayerCheckpoint(playerid, 15.0000, 15.0000, 2.0000, 5, CHECKPOINT_M4))
return SendClientMessage(playerid, -1, "{1E90FF}Checkpoint:{BEBEBE} Error, could not set the checkpoint.");
return CMD_SUCCESS;
}
CMD:rich(playerid, params[]) {
if(!SetPlayerCheckpoint(playerid, 10.0000, 10.0000, 2.0000, 5, CHECKPOINT_CASH))
return SendClientMessage(playerid, -1, "{1E90FF}Checkpoint:{BEBEBE} Error, could not set the checkpoint.");
return CMD_SUCCESS;
}
CMD:cphelp(playerid, params[]) {
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "{696969}Checkpoint Help", "{1E90FF}==================================================\n{696969}Checkpoints:\n{FFFFFF}* /oldcp1, /oldcp2, /deagle, /m4, /rich\n\n{696969}Commands:\n{FFFFFF}* /cpdisable, /cpvalid, /cppos, /cpsize, /cprange, /cpdistance\n{1E90FF}==================================================", "Ok", "");
return CMD_SUCCESS;
}
CMD:cpdisable(playerid, params[]) {
if(!DisablePlayerCheckpoint(playerid))
return SendClientMessage(playerid, -1, "{1E90FF}Checkpoint:{BEBEBE} Error, no checkpoint has been set.");
SendClientMessage(playerid, -1, "{1E90FF}Checkpoint:{BEBEBE} Successfully disabled the checkpoint.");
return CMD_SUCCESS;
}
CMD:cpvalid(playerid, params[]) {
if(!IsValidCheckpoint(playerid))
return SendClientMessage(playerid, -1, "{1E90FF}Checkpoint:{BEBEBE} Error, checkpoint is invalid.");
SendClientMessage(playerid, -1, "{1E90FF}Checkpoint:{BEBEBE} Success, checkpoint is valid.");
return CMD_SUCCESS;
}
CMD:cppos(playerid, params[]) {
new
Float:x,
Float:y,
Float:z
;
if(!GetPlayerCheckpointPos(playerid, x, y, z))
return SendClientMessage(playerid, -1, "{1E90FF}Checkpoint:{BEBEBE} Error, no checkpoint has been set.");
new
cpString[80 + 1]
;
format(cpString, sizeof(cpString), "{1E90FF}Checkpoint:{BEBEBE} x = %f | y = %f | z = %f.", x, y, z);
SendClientMessage(playerid, -1, cpString);
return CMD_SUCCESS;
}
CMD:cpsize(playerid, params[]) {
new
Float:size
;
if(!GetPlayerCheckpointSize(playerid, size))
return SendClientMessage(playerid, -1, "{1E90FF}Checkpoint:{BEBEBE} Error, no checkpoint has been set.");
new
cpString[64 + 1]
;
format(cpString, sizeof(cpString), "{1E90FF}Checkpoint:{BEBEBE} The checkpoint size is: %f.", size);
SendClientMessage(playerid, -1, cpString);
return CMD_SUCCESS;
}
CMD:cprange(playerid, params[]) {
if(!IsValidCheckpoint(playerid))
return SendClientMessage(playerid, -1, "{1E90FF}Checkpoint:{BEBEBE} Error, no checkpoint has been set.");
if(!IsPlayerInRangeOfCheckpoint(playerid, 10.0000))
return SendClientMessage(playerid, -1, "{1E90FF}Checkpoint:{BEBEBE} Error, not within 10 yards of the checkpoint.");
SendClientMessage(playerid, -1, "{1E90FF}Checkpoint:{BEBEBE} Success, you are within 10 yards of the checkpoint.");
return CMD_SUCCESS;
}
CMD:cpdistance(playerid, params[]) {
new
Float:distance
;
if(!(distance = GetPlayerDistanceFromCheckpoint(playerid)))
return SendClientMessage(playerid, -1, "{1E90FF}Checkpoint:{BEBEBE} Error, no checkpoint has been set.");
new
cpString[73 + 1]
;
format(cpString, sizeof(cpString), "{1E90FF}Checkpoint:{BEBEBE} Distance to checkpoint is %.0f meters.", distance);
SendClientMessage(playerid, -1, cpString);
return CMD_SUCCESS;
}
public OnPlayerEnterCheckpoint(playerid) {
new
checkpointid
;
if((checkpointid = GetPlayerCheckpointId(playerid)) == CHECKPOINT_UNUSED) {
// Old checkpoint code here.
if(IsPlayerInRangeOfPoint(playerid, 5.0000, 5.0000, 5.0000, 2.0000) && playerCheckpoint[playerid] == CHECKPOINT_OLD_1) {
SetPlayerHealth(playerid, 100.0);
SendClientMessage(playerid, -1, "{1E90FF}Checkpoint:{BEBEBE} You have been healed.");
}
else if(IsPlayerInRangeOfPoint(playerid, 5.0000, 0.0000, 0.0000, 2.0000) && playerCheckpoint[playerid] == CHECKPOINT_OLD_2) {
SetPlayerArmour(playerid, 99.0);
SendClientMessage(playerid, -1, "{1E90FF}Checkpoint:{BEBEBE} You have received armour.");
}
DisablePlayerCheckpoint(playerid);
playerCheckpoint[playerid] = -1;
return 1;
}
// New checkpoint code here.
switch(checkpointid)
{
case CHECKPOINT_DEAGLE:
{
SendClientMessage(playerid, -1, "{1E90FF}Checkpoint:{BEBEBE} Enjoy your Deagle with 9999 ammo.");
GivePlayerWeapon(playerid, WEAPON_DEAGLE, 9999);
DisablePlayerCheckpoint(playerid);
return 1;
}
case CHECKPOINT_M4:
{
SendClientMessage(playerid, -1, "{1E90FF}Checkpoint:{BEBEBE} Enjoy your M4 with 9999 ammo.");
GivePlayerWeapon(playerid, WEAPON_M4, 9999);
DisablePlayerCheckpoint(playerid);
return 1;
}
case CHECKPOINT_CASH:
{
SendClientMessage(playerid, -1, "{1E90FF}Checkpoint:{BEBEBE} You are now $1,000,000 richer.");
GivePlayerMoney(playerid, 1000000);
DisablePlayerCheckpoint(playerid);
return 1;
}
}
return 0;
}
// Changelog 1.1.0 - 15.11.2015, 12:29 (Timezone: UTC+1)
Added two new callbacks, OnPlayerCheckpointSet and OnPlayerCheckpointDisable.
You can find description on the two callbacks inside the include file.
// Changelog 1.2.0 - 21.11.2015, 03:14PM (Timezone: GMT+1)
// New functions:
native SetPlayerRaceCheckpoint(playerid, type, Float:x, Float:y, Float:z, Float:nextx, Float:nexty, Float:nextz, Float:size, cp_id = UNUSED_CHECKPOINT_ID);
native DisablePlayerRaceCheckpoint(playerid);
native IsValidRaceCheckpoint(playerid);
native GetPlayerRaceCheckpointId(playerid);
native GetPlayerRaceCheckpointPos(playerid, &Float:x, &Float:y, &Float:z);
native GetPlayerRaceCheckpointNextPos(playerid, &Float:nextx, &Float:nexty, &Float:nextz);
native GetPlayerRaceCheckpointSize(playerid, &Float:size);
native IsPlayerInRangeOfRaceCheckpoint(playerid, Float:range);
native Float:GetPlayerDistanceFromRaceCheckpoint(playerid);
// New callbacks:
native OnPlayerRaceCheckpointSet(playerid);
native OnPlayerRaceCheckpointDisable(playerid)
// New hooked callbacks:
native OnPlayerEnterRaceCheckpoint(playerid);
native OnPlayerLeaveRaceCheckpoint(playerid)
// Changelog 1.2.1 - 21.11.2015, 04:26PM (Timezone: GMT+1)
Fixed warnings on compile.
if(!IsPlayerConnected(playerid) || IsPlayerNPC(playerid) || playerid == INVALID_PLAYER_ID || 0 > playerid || playerid > MAX_PLAYERS)
playerid == INVALID_PLAYER_ID || 0 > playerid || playerid > MAX_PLAYERS
Took a peak and this stood out.
Код:
if(!IsPlayerConnected(playerid) || IsPlayerNPC(playerid) || playerid == INVALID_PLAYER_ID || 0 > playerid || playerid > MAX_PLAYERS) Код:
playerid == INVALID_PLAYER_ID || 0 > playerid || playerid > MAX_PLAYERS |
C:\Users\startklaar\Desktop\LvCnr\pawno\include\lvcnr/Checkpoint.inc(449) : error 075: input line too long (after substitutions) C:\Users\startklaar\Desktop\LvCnr\pawno\include\lvcnr/Checkpoint.inc(450) : error 017: undefined symbol "c" C:\Users\startklaar\Desktop\LvCnr\pawno\include\lvcnr/Checkpoint.inc(451) : error 017: undefined symbol "pSize" C:\Users\startklaar\Desktop\LvCnr\pawno\include\lvcnr/Checkpoint.inc(451) : warning 217: loose indentation C:\Users\startklaar\Desktop\LvCnr\pawno\include\lvcnr/Checkpoint.inc(451) : error 029: invalid expression, assumed zero C:\Users\startklaar\Desktop\LvCnr\pawno\include\lvcnr/Checkpoint.inc(451) : error 029: invalid expression, assumed zero C:\Users\startklaar\Desktop\LvCnr\pawno\include\lvcnr/Checkpoint.inc(451) : fatal error 107: too many error messages on one line
445 :stock IsValidRaceCheckpoint(playerid) { 446: 447: if(!IsPlayerConnected(playerid) || IsPlayerNPC(playerid)) 448: return 0; 449: 450: if(playerRaceCheckpointData[playerid][cpId] == INVALID_CHECKPOINT_ID && playerRaceCheckpointData[playerid][cpType] == INVALID_CHECKPOINT_ID && playerRaceCheckpointData[playerid][cpX] == 0.0000 && playerRaceCheckpointData[playerid][cpY] == 0.0000 && playerRaceCheckpointData[playerid][cpZ] == 0.0000 && playerRaceCheckpointData[playerid][cpNextX] == 0.0000 && playerRaceCheckpointData[playerid][cpNextY] == 0.0000 && playerRaceCheckpointData[playerid][cpNextZ] == 0.0000 && playerRaceCheckpointData[playerid][cpSize] == 0.0000) 451: return 0; 452: 453: return 1; 454: }