SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 27/04/2012, 09:33 PM   #1
stormchaser206
Gangsta
 
stormchaser206's Avatar
 
Join Date: Jan 2012
Location: United States of America
Posts: 695
Reputation: 46
Default List of integers in GetPVarInt

Does anyone know what the integers you can use for GetPVarInt are?
stormchaser206 is offline   Reply With Quote
Old 27/04/2012, 09:34 PM   #2
ViniBorn
Godfather
 
ViniBorn's Avatar
 
Join Date: Aug 2010
Location: Brasília
Posts: 5,315
Reputation: 720
Default Re: List of integers in GetPVarInt

How so?
__________________



CONTATO: F A C E B O O K: @vinibornpawn

ViniBorn is offline   Reply With Quote
Old 27/04/2012, 09:36 PM   #3
stormchaser206
Gangsta
 
stormchaser206's Avatar
 
Join Date: Jan 2012
Location: United States of America
Posts: 695
Reputation: 46
Default Re: List of integers in GetPVarInt

If you dont know what i mean...
I mean like for example, money. (money is what it says on the function example on the wiki)
I need a list of them.
stormchaser206 is offline   Reply With Quote
Old 27/04/2012, 09:40 PM   #4
ViniBorn
Godfather
 
ViniBorn's Avatar
 
Join Date: Aug 2010
Location: Brasília
Posts: 5,315
Reputation: 720
Default Re: List of integers in GetPVarInt

Most functions work with integers.

Usually what works with life and coordinates, is float ...
Ex: GetPlayerHealt, GetPlayerPos, GetVehiclePos
__________________



CONTATO: F A C E B O O K: @vinibornpawn

ViniBorn is offline   Reply With Quote
Old 27/04/2012, 09:40 PM   #5
ReneG
High-roller
 
Join Date: Oct 2011
Location: Sublime Text 2
Posts: 1,906
Reputation: 337
Default Re: List of integers in GetPVarInt

Ummm, pretty self explanatory. Anything that's an integer can be used with GetPVarInt.
ReneG is offline   Reply With Quote
Old 27/04/2012, 09:42 PM   #6
stormchaser206
Gangsta
 
stormchaser206's Avatar
 
Join Date: Jan 2012
Location: United States of America
Posts: 695
Reputation: 46
Default Re: List of integers in GetPVarInt

is there a kills or somthing?
stormchaser206 is offline   Reply With Quote
Old 28/04/2012, 01:31 AM   #7
antonio112
Gangsta
 
antonio112's Avatar
 
Join Date: Aug 2009
Location: Romania
Posts: 970
Reputation: 87
Default Re: List of integers in GetPVarInt

All those variables you create yourself. For example, minutes on, hours on, kills, deaths, etc etc. You can basically use everything in variables. The thing is, you need to set the variables first. Let me give you an example:

pawn Code:
public OnPlayerDeath(playerid, killerid, reason)
{
// We check if killerid is a valid player id and give him one kill
    if(killerid != INVALID_PLAYER_ID)
        SetPVarInt(playerid, "Kills", GetPVarInt(playerid, "Kills") + 1);
    SetPVarInt(playerid, "Deaths", GetPVarInt(playerid, "Deaths") + 1); // Here we set a variable called "Deaths" to the player who died
    return 1;
}
// We create a command that resets a player kills
YCMD:resetkills(playerid, params[], help)
{
        #pragma unused help, params
        DeletePVar(playerid, "Kills");
        return 1;
}
// A command that resets deaths
YCMD:resetdeaths(playerid, params[], help)
{
        #pragma unused help, params
        DeletePVar(playerid, "Deaths");
        return 1;
}
// A command to check kills and deaths:
YCMD:checkstats(playerid, params[], help)
{
        #pragma unused help, params
        new str[128];
        format(str, sizeof str, "You have %i kills and %i deaths.", GetPVarInt(playerid, "Kills"), GetPVarInt(playerid, "Deaths"))
        SendClientMessage(playerid, -1, str);
        return 1;
}

Now, you might wonder, why do I delete those variables. Well, instead of setting a player variable to 0, it's better to delete it. You can of course, set it to 0 using "SetPVarInt(playerid, "Deaths", 0);

Now, the "Kills" and "Deaths" variables, you can name it whatever you want. It doesn't matter.
__________________
antonio112 is offline   Reply With Quote
Old 28/04/2012, 01:48 AM   #8
ReneG
High-roller
 
Join Date: Oct 2011
Location: Sublime Text 2
Posts: 1,906
Reputation: 337
Default Re: List of integers in GetPVarInt

It's actually better to use regular variables. Go ahead and learn it, but PVars use more RAM than a regular variable.
ReneG 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
Optional Integers? SSCANF. Dokins Scripting Help 4 24/01/2012 09:05 PM
Help with Dialog, Strings, and Integers HydraX Help Archive 18 24/07/2011 07:40 PM
function that will return two integers DRIFT_HUNTER Help Archive 2 17/06/2011 05:16 PM
Get Integers in a Single Line zallomallo Help Archive 1 29/06/2009 05:48 PM


All times are GMT. The time now is 03:58 PM.


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