Increasing PVar
#1

Hey

I've got a Spawn Weapons dialog, which has a PVar what is 1 on connection, then when the player choose the weapon, I want it increasing. (when 3, then return "Must reset lammer!!11")

I made a lil' stock for it but it isn't working. I tried the easier way too like SetPVarInt(playerid,"SpawnCount",GetPVarInt(player id,"SpawnCount")+1); but it's not working. Here is the stock:
pawn Код:
stock IncreasePVarInt(playerid,PvarInt[]) {
    new inc;
    inc = GetPVarInt(playerid,PvarInt);
    inc++;
    SetPVarInt(playerid,PvarInt,inc);
    return 1;
}
Still the same result :\
Reply
#2

pawn Код:
#define SetPVarIntEx(%0,%1,%2,%3) SetPVarInt(%0,%1, GetPVarInt(%0,%1) %2 %3)
Usage:

pawn Код:
SetPVarIntEx(playerid, "NameOfPVar", +, 1); //+ can be +, -, / and *, and 1 is increase rate
Reply
#3

Well, not working.
Here is mah code:
pawn Код:
if(dialogid == 7) {
        if(strcmp(inputtext,"reset",true) == 0) {
            for(new i = 0; i < 4; i++) {
                if(PlayerWeapons[playerid][i] != -1) {
                    PlayerWeapons[playerid][i] = -1;
                }
            }
            SetPVarInt(playerid,"SpawnCount",1);
            SendClientMessage(playerid,white,"Your spawn weapons have been resetted.");
            return SpawnDialog(playerid);
        }
        if(GetPVarInt(playerid,"SpawnCount") == 3) { SpawnDialog(playerid); return SendClientMessage(playerid,white,"You must reset your spawn weapons to choose new ones."); }
        if(strcmp(inputtext,"1",true) == 0) {
            PlayerWeapons[playerid][GetPVarInt(playerid,"SpawnCount")] = 24;
            PlayerWeapons[playerid][0] += 50;
            format(text,sizeof(text),"%i.: Desert Eagle",GetPVarInt(playerid,"SpawnCount"));
            SendClientMessage(playerid,white,text);
            SetPVarIntEx(playerid, "NameOfPVar", +, 1);
            return SpawnDialog(playerid);
        }else if(strcmp(inputtext,"2",true) == 0) {
            PlayerWeapons[playerid][GetPVarInt(playerid,"SpawnCount")] = 25;
            PlayerWeapons[playerid][0] += 80;
            format(text,sizeof(text),"%i.: Shotgun",GetPVarInt(playerid,"SpawnCount"));
            SendClientMessage(playerid,white,text);
            SetPVarIntEx(playerid, "NameOfPVar", +, 1);
            return SpawnDialog(playerid);
        } else if(strcmp(inputtext,"3",true) == 0) {
            PlayerWeapons[playerid][GetPVarInt(playerid,"SpawnCount")] = 27;
            PlayerWeapons[playerid][0] += 100;
            format(text,sizeof(text),"%i.: Combat Shotgun",GetPVarInt(playerid,"SpawnCount"));
            SendClientMessage(playerid,white,text);
            SetPVarIntEx(playerid, "NameOfPVar", +, 1);
            return SpawnDialog(playerid);
        } else if(strcmp(inputtext,"4",true) == 0) {
            PlayerWeapons[playerid][GetPVarInt(playerid,"SpawnCount")] = 29;
            PlayerWeapons[playerid][0] += 120;
            format(text,sizeof(text),"%i.: MP5",GetPVarInt(playerid,"SpawnCount"));
            SendClientMessage(playerid,white,text);
            SetPVarIntEx(playerid, "NameOfPVar", +, 1);
            return SpawnDialog(playerid);
        } else if(strcmp(inputtext,"5",true) == 0) {
            PlayerWeapons[playerid][GetPVarInt(playerid,"SpawnCount")] = 30;
            PlayerWeapons[playerid][0] += 140;
            format(text,sizeof(text),"%i.: AK-47",GetPVarInt(playerid,"SpawnCount"));
            SendClientMessage(playerid,white,text);
            SetPVarIntEx(playerid, "NameOfPVar", +, 1);
            return SpawnDialog(playerid);
        } else if(strcmp(inputtext,"6",true) == 0) {
            PlayerWeapons[playerid][GetPVarInt(playerid,"SpawnCount")] = 31;
            PlayerWeapons[playerid][0] += 180;
            format(text,sizeof(text),"%i.: M4",GetPVarInt(playerid,"SpawnCount"));
            SendClientMessage(playerid,white,text);
            SetPVarIntEx(playerid, "NameOfPVar", +, 1);
            return SpawnDialog(playerid);
        } else if(strcmp(inputtext,"7",true) == 0) {
            PlayerWeapons[playerid][GetPVarInt(playerid,"SpawnCount")] = 33;
            PlayerWeapons[playerid][0] += 150;
            format(text,sizeof(text),"%i.: Country Rifle",GetPVarInt(playerid,"SpawnCount"));
            SendClientMessage(playerid,white,text);
            SetPVarIntEx(playerid, "NameOfPVar", +, 1);
            return SpawnDialog(playerid);
        } else if(strcmp(inputtext,"8",true) == 0) {
            PlayerWeapons[playerid][GetPVarInt(playerid,"SpawnCount")] = 34;
            PlayerWeapons[playerid][0] += 250;
            format(text,sizeof(text),"%i.: AK-47",GetPVarInt(playerid,"SpawnCount"));
            SendClientMessage(playerid,white,text);
            SetPVarIntEx(playerid, "NameOfPVar", +, 1);
            return SpawnDialog(playerid);
        } else if(strcmp(inputtext,"9",true) == 0 || strcmp(inputtext,"back",true) == 0) {
            format(text,sizeof(text),"Total Payment on spawn: %i",PlayerWeapons[playerid][0]);
            SendClientMessage(playerid,white,text);
            return Dialog(playerid,"ammu");
        } else if(strcmp(inputtext,"release",true) == 0) {
            return release(playerid);
        } else {
            return SpawnDialog(playerid);
        }
    }
Reply
#4

untested but this should work too

pawn Код:
#define PVarInt(%1,%2)++; SetPVarInt(%1,%2,GetPVarInt(%1,%2) + 1);
then you should be able to use in the script

pawn Код:
PVarInt(playerid,"variable")++;
Reply
#5

No, it won't. Same as black_dota's. Maybe there's something in the code what sets that PVar to 1 :\

EDIT: LOLWUT. I forgot to set the PvarName thingy in black_dota's XD

EDIT02: Still not working -.-
Reply
#6

*Sorry for DB*

omgf wtf ftw lmao: I found a SetPVarInt(playerid,"SpawnCount",1); right under OnDialogResponse.
I'm disappointed. xD
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)