SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 26/12/2012, 12:06 PM   #1
NicholasA
Huge Clucker
 
NicholasA's Avatar
 
Join Date: Nov 2012
Location: Athene
Posts: 398
Reputation: 9
Default storing data?

Hey guys i was wondering on how i could do something like this:

When you type a command like /buybooboo
The server knows that you have bought a booboo and wont allow you to buy more booboo's.
Also there is a command /wearbooboo that you can only type when you have bought a booboo
__________________
CoMiC SaNs
NicholasA is offline   Reply With Quote
Old 26/12/2012, 12:17 PM   #2
DaRk_RaiN
Gangsta
 
DaRk_RaiN's Avatar
 
Join Date: Sep 2012
Posts: 973
Reputation: 207
Default Re: storing data?

Use a variable,this method is not insured in case the player disconnects, else use Y_INI to save them
pawn Code:
new bbooboo[MAX_PLAYERS];
new wbooboo[MAX_PLAYERS];
pawn Code:
if (strcmp("/buybooboo", cmdtext, true, 10) == 0)
    {
        // your script bla bla
        bbooboo[playerid] = 1;//now this will make you know if he bought
        return 1;
    }
    if (strcmp(" /wearbooboo", cmdtext, true, 10) == 0)
    {
        // your script bla bla
        wbooboo[playerid] = 1;//now this will make you know if he wears it.
        return 1;
    }
Now if you want him to only buy this bla bla once
pawn Code:
if (strcmp("/buybooboo", cmdtext, true, 10) == 0)
    {
        if(bbooboo[playerid] == 1)return SendClientMessage(playerid,-1,"Dude wtf you already bought one");//he won't be abl to buy an other one unless he uses this one
        // your script bla bla
        bbooboo[playerid] = 1;//now this will make you know if he bought
        return 1;
    }
Now when he wears that bla bla He'll have to buy an other one
pawn Code:
if (strcmp(" /wearbooboo", cmdtext, true, 10) == 0)
    {
        if(bbooboo[playerid] == 0)return SendClientMessage(playerid,-1,"You don't have a bbooboo to wear");//in case he doesn't have a blabla
        bbooboo[playerid] = 0;//this will make him lose a bla bla
        // your script bla bla
        wbooboo[playerid] = 1;//now this will make you know if he wears it.
        return 1;
    }
If your looking for an other way of using those tell me.
DaRk_RaiN is offline   Reply With Quote
Old 27/12/2012, 09:29 AM   #3
NicholasA
Huge Clucker
 
NicholasA's Avatar
 
Join Date: Nov 2012
Location: Athene
Posts: 398
Reputation: 9
Default Re: storing data?

Quote:
Originally Posted by DaRk_RaiN View Post
Use a variable,this method is not insured in case the player disconnects, else use Y_INI to save them
pawn Code:
new bbooboo[MAX_PLAYERS];
new wbooboo[MAX_PLAYERS];
pawn Code:
if (strcmp("/buybooboo", cmdtext, true, 10) == 0)
    {
        // your script bla bla
        bbooboo[playerid] = 1;//now this will make you know if he bought
        return 1;
    }
    if (strcmp(" /wearbooboo", cmdtext, true, 10) == 0)
    {
        // your script bla bla
        wbooboo[playerid] = 1;//now this will make you know if he wears it.
        return 1;
    }
Now if you want him to only buy this bla bla once
pawn Code:
if (strcmp("/buybooboo", cmdtext, true, 10) == 0)
    {
        if(bbooboo[playerid] == 1)return SendClientMessage(playerid,-1,"Dude wtf you already bought one");//he won't be abl to buy an other one unless he uses this one
        // your script bla bla
        bbooboo[playerid] = 1;//now this will make you know if he bought
        return 1;
    }
Now when he wears that bla bla He'll have to buy an other one
pawn Code:
if (strcmp(" /wearbooboo", cmdtext, true, 10) == 0)
    {
        if(bbooboo[playerid] == 0)return SendClientMessage(playerid,-1,"You don't have a bbooboo to wear");//in case he doesn't have a blabla
        bbooboo[playerid] = 0;//this will make him lose a bla bla
        // your script bla bla
        wbooboo[playerid] = 1;//now this will make you know if he wears it.
        return 1;
    }
If your looking for an other way of using those tell me.
+ rep thx, helped me with using variables
__________________
CoMiC SaNs
NicholasA is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
MySQL - Query not storing data Deal-or-die Scripting Help 6 28/06/2012 01:39 PM
Storing data into an array? Deal-or-die Scripting Help 0 01/05/2012 07:00 PM
Whats better for storing data? Desertsoulz Help Archive 19 24/04/2011 12:44 AM
Storing data into the variables...? Scenario Help Archive 4 06/11/2010 05:37 PM


All times are GMT. The time now is 09:15 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.