/NewLife command?
#1

Hi,

I am wanting to create a new life command, that when used, asks for confirmation, If /yes, then takes you back to character selection, removes all money, items etc etc, but keeps account info fine (like password).. and if /no, well you get it, would just cancel..

I am quite the beginner, and really need some guidance :S
Reply
#2

I also would like to know how to do this.
Reply
#3

Well.. What script is your base? I need to know if your using playerinfo.. etc.. etc.. and what do you want to reset... If any of you could contact me on Skype or MSN so we can figure something out i would love to help you. Thanks..

- Richard
Reply
#4

Quote:
Originally Posted by Richard Steinheimer
Посмотреть сообщение
Well.. What script is your base? I need to know if your using playerinfo.. etc.. etc.. and what do you want to reset... If any of you could contact me on Skype or MSN so we can figure something out i would love to help you. Thanks..

- Richard
Sent you a message
Reply
#5

I am using the Land of Paradise GM, you mean like PlayerInfo[playerid] etc, if so, then yes..
Reply
#6

This should be a pretty good start for you:

pawn Код:
#include <YSI\y_timers> // the timer I wrote uses y_timers, it's better than SetTimer and SetTimerEx IMHO

new
    bool:requestingNewLife[MAX_PLAYERS], // create the boolean variable for determining if a player is requesting a new life
    Timer:newLifeTimer[MAX_PLAYERS]; // create the timer variable to determine the timer ID at a later time

CMD:newlife(playerid, params[])
{
    if(requestingNewLife[playerid]) // are they already requesting a new life?
        return SendClientMessage(playerid, COLOR_RED, "ERROR: Please type \"/yes\" in order to start a new life."); // if so, send a message telling them to type /yes to accept it
   
    requestingNewLife[playerid] = true; // tell the server that they're requesting a new life
    newLifeTimer[playerid] = defer timerAutoCancelNewlife(playerid); // start an auto-cancellation timer
    SendClientMessage(playerid, COLOR_WHITE, "In order to continue, type \"/yes\", otherwise, to cancel, you can type \"/no\"");
    return 1;
}

CMD:no(playerid, params[])
{
    if(!requestingNewLife[playerid])
        return 1;
   
    stop newLifeTimer[playerid]; // stop the timer
    requestingNewLife[playerid] = false; // tell the server they're no longer requesting a new life
    SendClientMessage(playerid, COLOR_WHITE, "You have cancelled your new life request.");
    return 1;
}

CMD:yes(playerid, params[])
{
    if(!requestingNewLife[playerid])
        return 1;
   
    stop newLifeTimer[playerid]; // stop the timer
    requestingNewLife[playerid] = false; // tell the server they're no longer requesting a new life, you're going to process it below:
   
    // use your saving/loading system functions to reset the player's vars
    return 1;
}

timer timerAutoCancelNewLife[60000](playerid) // this timer will auto-cancel the request after a minute
{
    requestingNewLife[playerid] = false;
    SendClientMessage(playerid, COLOR_RED, "Your new life request has been automatically canceled.");
    return 1;
}
Reply
#7

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
This should be a pretty good start for you:

pawn Код:
#include <YSI\y_timers> // the timer I wrote uses y_timers, it's better than SetTimer and SetTimerEx IMHO

new
    bool:requestingNewLife[MAX_PLAYERS], // create the boolean variable for determining if a player is requesting a new life
    Timer:newLifeTimer[MAX_PLAYERS]; // create the timer variable to determine the timer ID at a later time

CMD:newlife(playerid, params[])
{
    if(requestingNewLife[playerid]) // are they already requesting a new life?
        return SendClientMessage(playerid, COLOR_RED, "ERROR: Please type \"/yes\" in order to start a new life."); // if so, send a message telling them to type /yes to accept it
   
    requestingNewLife[playerid] = true; // tell the server that they're requesting a new life
    newLifeTimer[playerid] = defer timerAutoCancelNewlife(playerid); // start an auto-cancellation timer
    SendClientMessage(playerid, COLOR_WHITE, "In order to continue, type \"/yes\", otherwise, to cancel, you can type \"/no\"");
    return 1;
}

CMD:no(playerid, params[])
{
    if(!requestingNewLife[playerid])
        return 1;
   
    stop newLifeTimer[playerid]; // stop the timer
    requestingNewLife[playerid] = false; // tell the server they're no longer requesting a new life
    SendClientMessage(playerid, COLOR_WHITE, "You have cancelled your new life request.");
    return 1;
}

CMD:yes(playerid, params[])
{
    if(!requestingNewLife[playerid])
        return 1;
   
    stop newLifeTimer[playerid]; // stop the timer
    requestingNewLife[playerid] = false; // tell the server they're no longer requesting a new life, you're going to process it below:
   
    // use your saving/loading system functions to reset the player's vars
    return 1;
}

timer timerAutoCancelNewLife[60000](playerid) // this timer will auto-cancel the request after a minute
{
    requestingNewLife[playerid] = false;
    SendClientMessage(playerid, COLOR_RED, "Your new life request has been automatically canceled.");
    return 1;
}
Hello, I'm sorry this is a stupid question, but where do you place that script? sorry I'm a beginner

I tried and it said this fatal error 111: user error: "Old foreach.inc files are no longer compatible with YSI."
Reply
#8

I got error,

Old foreach.inc files are no longer compatible with YSI.
Reply
#9

Assuming you use zcmd, which you SHOULD be doing, you'd place all of the CMD: parts anywhere (outside of a callback/function). You can put the "timer timerAudoCancelNewLife" part anywhere (outside of a callback/function).

The new part can go towards the top of your script. And, the #include part goes with all of the others in your script.
Reply
#10

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
Assuming you use zcmd, which you SHOULD be doing, you'd place all of the CMD: parts anywhere (outside of a callback/function). You can put the "timer timerAudoCancelNewLife" part anywhere (outside of a callback/function).

The new part can go towards the top of your script. And, the #include part goes with all of the others in your script.
fatal error 111: user error: "Old foreach.inc files are no longer compatible with YSI."

And these are my includes

#include <a_samp>
#include <iee>
#include <Ldudb>
#include <KZI>
#include <streamer>
#include <YSF>
#include <zcmd>
#include <foreach>
#include <YSI\y_timers>
#pragma dynamic 556992
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)