Challenge
#1

Hello iam making a challenge system i use this from samp wiki

PHP код:
// In this example the player's checkpoint will be set when they spawn.
// On entering the checkpoint they will receive $1000 and the checkpoint will be disabled.
 
new bool:onCheck[MAX_PLAYERS];
 
public 
OnPlayerSpawn(playerid)
{
    
SetPlayerCheckpoint(playerid1982.6150, -220.6680, -0.24323.0);
    
onCheck[playerid] = true;
    return 
1;
}
 
public 
OnPlayerEnterCheckpoint(playerid)
{
    if(
onCheck[playerid]) // if it's true  
    

        
GivePlayerMoney(playerid1000);
        
DisablePlayerCheckpoint(playerid);
        
onCheck[playerid] = false;
    }
    return 
1;

So how to show the checkpoint only for the player who is in the challenge? also if he go to take it how to check that this Checkpoint is for the challenge {Test}?
Reply
#2

I do not understand what you want, but I think maybe this will help you

PHP код:
CMD:challenge(playeridparams[])
{
    new 
id;
    if(
sscanf(params,"d"id)) {
        
SCM(playerid, -1"usage: /challenge [playerid]");
    }
    else {
        if(
onCheck[id] == false) { // checking id already on challenge or not
            
onCheck[id] = true
            
SCM(id, -1"you have set to challenge mode"); // send id message
            
new str[128];
            
format(str,sizeof(str),"you have set %s to challenge mode"GetName(id));
            
SCM(playerid, -1str);
            
SetPlayerCheckpoint(id1982.6150, -220.6680, -0.24323.0); // setting id checkpoint
        
}
        else {
            
SCM(playerid, -1"player is already on challenge mode");
        }
    }
    return 
1;
}
public 
OnPlayerConnect(playerid)
{
    
onCheck[playerid] = false// set challenge to false
    
return 1;
}
public 
OnPlayerEnterCheckpoint(playerid

    if(
onCheck[playerid]) {  // if it's true   
        
GivePlayerMoney(playerid1000); 
        
DisablePlayerCheckpoint(playerid); 
        
onCheck[playerid] = false
    } 
    return 
1
}  
    
public 
OnPlayerSpawn(playerid

    if(
onCheck[playerid]) { // check if id already on challenge
        
SetPlayerCheckpoint(playerid1982.6150, -220.6680, -0.24323.0); 
        
SCM(id, -1"you have enter challenge mode");
    }
    else if(!
onCheck[playerid]) {
        
DisablePlayerCheckpoint(playerid); // disable checkpoint
    
}
    return 
1

Reply
#3

Quote:
Originally Posted by kloning1
Посмотреть сообщение
I do not understand what you want, but I think maybe this will help you

PHP код:
CMD:challenge(playeridparams[])
{
    new 
id;
    if(
sscanf(params,"d"id)) {
        
SCM(playerid, -1"usage: /challenge [playerid]");
    }
    else {
        if(
onCheck[id] == false) { // checking id already on challenge or not
            
onCheck[id] = true
            
SCM(id, -1"you have set to challenge mode"); // send id message
            
new str[128];
            
format(str,sizeof(str),"you have set %s to challenge mode"GetName(id));
            
SCM(playerid, -1str);
            
SetPlayerCheckpoint(id1982.6150, -220.6680, -0.24323.0); // setting id checkpoint
        
}
        else {
            
SCM(playerid, -1"player is already on challenge mode");
        }
    }
    return 
1;
}
public 
OnPlayerConnect(playerid)
{
    
onCheck[playerid] = false// set challenge to false
    
return 1;
}
public 
OnPlayerEnterCheckpoint(playerid

    if(
onCheck[playerid]) {  // if it's true   
        
GivePlayerMoney(playerid1000); 
        
DisablePlayerCheckpoint(playerid); 
        
onCheck[playerid] = false
    } 
    return 
1
}  
    
public 
OnPlayerSpawn(playerid

    if(
onCheck[playerid]) { // check if id already on challenge
        
SetPlayerCheckpoint(playerid1982.6150, -220.6680, -0.24323.0); 
        
SCM(id, -1"you have enter challenge mode");
    }
    else if(!
onCheck[playerid]) {
        
DisablePlayerCheckpoint(playerid); // disable checkpoint
    
}
    return 
1

Not this i mean minigame like player spawn with a car and then reach checkpoint and if he is not in minigame he don't get reward when he reach it
Reply
#4

help/?
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)