id chekpoint
#1

yo i wanna know if i can put id for checkpoint example :


if (idcheackpoint = 1)

sendmessage ....

if (idcheckpoint = 2)

getplayername......
Reply
#2

I don't really understand your Question, but you are doing something wrong there.
"idcheckpoint = 2" is not a comparison. Its an assignment, which in general
always returns a true value.
You need to use "==" so it would like this:
Код:
if (idcheckpoint == 2)
And one request to you: Learn English, please.
Or at least use the ****** Translator. I'm sure it returns better results. :P
Reply
#3

I want to do two checkpoint may have given the id to each checkpoint?

exemple use

if (idck == 1)

do that

if (idck == 2)

do that


sorry for my bad english
Reply
#4

The problem here is that checkpoints unfortunately do not have IDs.
So I'm not really sure where do you want to get the from.
Furthermore you can only have one checkpoint at a time for a specific player.

So what you will need to do is some voodoo magic with pickups and frequently
looking at the players position and checking whether he is in range of one of your
pseudo checkpoints.
Reply
#5

I know it's not impossible to do two checkpoint but look at my code you will understand what I want to do:

Quote:

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])

{
switch(dialogid) // switch statement

{
// -------------------------------------- Register System ----------------------------------------- // ---------------------------------- GPS --------------------------------------------------------------

case 1:

{

new name[MAX_PLAYER_NAME], file[256], string[128];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), SERVER_USER_FILE_ACCOUNT, name);
if(!response) return Kick(playerid);
if (!strlen(inputtext)) return
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Hi your not registered", "Welcome, your not registered mate, input your registration pw below", "Register", "Leave");
dini_Create(file);
dini_IntSet(file, "Password", udb_hash(inputtext));
dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel] = 0);
dini_IntSet(file, "Money",PlayerInfo[playerid][pCash] = 500);
dini_IntSet(file, "Score",PlayerInfo[playerid][pScore] = 0);
format(string, 128, "[SYSTEM]: You succesfully registered the nickname %s with password %s, you have been auto logged in.", name, inputtext);
SendClientMessage(playerid, COLOR_YELLOW, string);
gPlayerLogged[playerid] = 1;

}

case 2:

{

new name[MAX_PLAYER_NAME], file[256], string[128];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), SERVER_USER_FILE_ACCOUNT, name);
if(!response) return Kick(playerid);
if (!strlen(inputtext)) return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Hi your registered", "Fucken awesome mate, your registered . Inpute your pw below", "Login", "Leave");
new tmp;
tmp = dini_Int(file, "Password");
if(udb_hash(inputtext) != tmp)

{
SendClientMessage(playerid, COLOR_RED, "Wrong PW sir.");
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Hi your registered", "Fucken awesome mate, your registered . Inpute your pw below", "Login", "Leave");

}
else

{
gPlayerLogged[playerid] = 1;
PlayerInfo[playerid][pAdminLevel] = dini_Int(file, "AdminLevel");
SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
GivePlayerMoney(playerid, dini_Int(file, "Money")-GetPlayerMoney(playerid));
SendClientMessage(playerid,COLOR_RED, "[SYSTEM]: Successfully logged in!");
}
}
//-------------------------------------- GPS MENU-----------------------------------------
case 3:

{

switch(listitem)

{
case 0: SetPlayerCheckpoint(playerid, 1218.15, -1811.71, 16.59, 5);
case 1: SetPlayerCheckpoint(playerid, 1684.48, -1342.41, 17.43, 5);
case 2: SetPlayerCheckpoint(playerid, 1464.80, -1011.25, 26.84, 5);
case 3: SetPlayerCheckpoint(playerid, 1149.39, -1749.36, 13.57, 5);
}

}

}
return 1;
}
Quote:

DisablePlayerCheckpoint(playerid);
SendClientMessage(playerid,COLOR_WHITE," Vous etes arriver a destination");//indique qu'il est arriver au marqueur rouge
return 1;

I mean for example if it uses the GPS when it arrives at the checkpoint, he gets the message and if for example the lumberjack profession when he arrives at Checkpoint This now was told to cut wood
Reply
#6

Yes, you can create multiple checkpoints, but only one at a time is displayed to the player.
So you somehow need to safe an id in a variable or pvar for the last created checkpoint.
For example:
Код:
switch(listitem) {
        case 0: {
                SetPlayerCheckpoint(playerid, 1218.15, -1811.71, 16.59, 5);
                SetPVarInt(playerid, "lastcheckpoint", 1);
        }
        case 1: {
                SetPlayerCheckpoint(playerid, 1684.48, -1342.41, 17.43, 5);
                SetPVarInt(playerid, "lastcheckpoint", 2);
        }
        case 2: {
                SetPlayerCheckpoint(playerid, 1464.80, -1011.25, 26.84, 5);
                SetPVarInt(playerid, "lastcheckpoint", 3);
        }
        case 3: {
                SetPlayerCheckpoint(playerid, 1149.39, -1749.36, 13.57, 5);
                SetPVarInt(playerid, "lastcheckpoint", 4);
        }
}
And to check which checkpoint the player entered:
Код:
public OnPlayerEnterCheckpoint(playerid) {
        switch(GetPVarInt(playerid, "lastcheckpoint")) {
                case 1: dosomestuff(); // First checkpoint from navi 
                case 2: dosomeotherstuff(); // Second checkpoint from navi 
                //...
        }
        DisablePlayerCheckpoint(playerid);
}
Reply
#7

yea thx
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)