if (strcmp("/guide", cmdtext, true, 10) == 0)
{
SendClientMessage(playerid, COLOR_RED, "You have opened your guide booklet.");
SendClientMessage(playerid, COLOR_RED, "First, we start off showing you where the bank is");
SendClientMessage(playerid, COLOR_RED, "You can Deposit and Withdraw money in here.");
SetPlayerCheckpoint(playerid, 1462.6707, -1022.0826, 23.8281, 3.0);
SendClientMessage(playerid, COLOR_RED, "A marker has been set at the bank.");
return 1;
}
return 0;
}
DisablePlayerCheckpoint(playerid);
return 1;
}
if (strcmp("/guide", cmdtext, true) == 0)
{
SendClientMessage(playerid, COLOR_RED, "You have opened your guide booklet.");
SendClientMessage(playerid, COLOR_RED, "First, we start off showing you where the bank is");
SendClientMessage(playerid, COLOR_RED, "You can Deposit and Withdraw money in here.");
SetPlayerCheckpoint(playerid, 1462.6707, -1022.0826, 23.8281, 3.0);
SetPVarInt(playerid, "Guide", 1);
SendClientMessage(playerid, COLOR_RED, "A marker has been set at the bank.");
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
switch(GetPVarInt(playerid, "Guide"))
{
case 1:
{
SendClientMessage(playerid, COLOR_RED, "Good, you found a bank, now to the LSPD");
SetPlayerCheckpoint(playerid, ...);
SetPVarInt(playerid, "Guide", 2);
}
case 2:
{
SendClientMessage(playerid, COLOR_RED, "Good, you found the LSPD, now to ...");
SetPlayerCheckpoint(playerid, ...);
SetPVarInt(playerid, "Guide", 3);
}
...
}
return 1;
}
#define COLOR_RED 0xAA3333FF
#define MAX_CHECKPOINTS 2//total checkpoints
#define CPBANK 0//cpid for bank
#define NOWHERE 1 //define a name for each cp id here
enum checkpointinfo {
CPID,
Float:X,
Float:Y,
Float:Z,
Float:Size
};
new Checkpoints[MAX_CHECKPOINTS][checkpointinfo]={
// X Y Z Size
{CPBANK,1462.6707, -1022.0826, 23.8281, 3.0},
//add more cps here
{NOWHERE,0.0,0.0,0.0,3.0)
};
new PlayersCheckpoint[MAX_PLAYERS];//tracks the player current checkpoint
stock SetGameCheckpoint(playerid,cpid){
DisablePlayerCheckpoint(playerid);
PlayersCheckpoint[playerid] = cpid;//save players new checkpoint id
SetPlayerCheckpoint(playerid,Checkpoints[cpid][X],Checkpoints[cpid][Y],Checkpoints[cpid][Z],Checkpoints[cpid][Size]);//load the cp
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/guide", cmdtext, true, 10) == 0)
{
SendClientMessage(playerid, COLOR_RED, "You have opened your guide booklet.");
SendClientMessage(playerid, COLOR_RED, "First, we start off showing you where the bank is");
SendClientMessage(playerid, COLOR_RED, "You can Deposit and Withdraw money in here.");
SendClientMessage(playerid, COLOR_RED, "A marker has been set at the bank.");
SetGameCheckpoint(playerid,CPBANK);//use our little command to load the cp
SetPVarInt(playerid, "Guide", 1);
return 1;
}
return 0;
}
public OnPlayerEnterCheckpoint(playerid){
new cpid = PlayersCheckpoint[playerid]; //lookup current cp
if(GetPVarInt(playerid, "Guide") > 0){//is player doing the guide?
switch(GetPVarInt(playerid, "Guide")) {
case 1: {
SendClientMessage(playerid, COLOR_RED, "Good, you found a bank, now to the LSPD");
SetGameCheckpoint(playerid,NOWHERE);
SetPVarInt(playerid, "Guide", 2);
}
case 2:{
SendClientMessage(playerid, COLOR_RED, "Good, you found the LSPD, now to ...");
SetGameCheckpoint(playerid,CPBANK);
SetPVarInt(playerid, "Guide", 3);
}
}
switch(cpid){
case CPBANK:{
SendClientMessage(playerid, COLOR_RED, "Welcome to the bank you balance is $32809138932");
}
case NOWHERE:{
SendClientMessage(playerid, COLOR_RED, "Where the hell am i...");
}
}
}
return 1;
}
stock GetPlayerDistanceToPoint(playerid,Float:x,Float:y){ //By Sacky (Edited by Smugller)
new Float:x1,Float:y1,Float:z1;
new Float:dis;
GetPlayerPos(playerid,x1,y1,z1);
dis = floatsqroot((x-x1)*(x-x1)+(y-y1)*(y-y1));
return floatround(dis);
}
stock CheckpointUpdatd(playerid){
new cprange = 10000,cpid;
new(new i=0;i<MAX_CHECKPOINTS;i++){
new tmp;
tmp = GetPlayerDistanceToPoint(playerid,Checkpoints[cpid][X],Checkpoints[cpid][Y]);
if(tmp < cprange){
cprange = tmp
cpid = i;
}
}
SetGameCheckpoint(playerid,cpid);
}
pawn Код:
pawn Код:
|
if (strcmp("/guide", cmdtext, true) == 0){
if(GetPVarInt(playerid, "Guide") > 0){
SendClientMessage(playerid, COLOR_RED, "You can only use the 'guide' command once per visit.");
return 1;
}
SendClientMessage(playerid, COLOR_RED, "You have opened your guide booklet.");
SendClientMessage(playerid, COLOR_RED, "First, we start off showing you where the bank is");
SendClientMessage(playerid, COLOR_RED, "You can Deposit and Withdraw money in here.");
SetPlayerCheckpoint(playerid, 1462.6707, -1022.0826, 23.8281, 3.0);
SetPVarInt(playerid, "Guide", 1);
SendClientMessage(playerid, COLOR_RED, "A marker has been set at the bank.");
return 1;
}