New Scripter
#1

Hello I'm new to Scripting in Pawn/SA-MP Servers.
First Question
Is there a Tutorial for making Shops for Weapons, and other such items?

I want to save guns and there ammo, so right now here is my save file:
Код:
Password=192676593
Ip=127.0.0.1
Level=10
Cash=4500
Deaths=0
Bankcash=10000
Score=0
PrimWep=33
SubWep=23
MeleeWep=8
PrimWep_Ammo=200
SubWep_Ammo=200
MeleeWep_Ammo=1
and my Pawn Dini saving Code:
PHP код:
    dini_IntSet(playerfile"PrimWep"GetPVarInt(playerid,"PrimWep"));
    
dini_IntSet(playerfile"SubWep"GetPVarInt(playerid,"SubWep"));
    
dini_IntSet(playerfile"MeleeWep"GetPVarInt(playerid,"MeleeWep"));
    
dini_IntSet(playerfile"PrimWep_Ammo"GetPVarInt(playerid,"PrimWep_Ammo"));
    
dini_IntSet(playerfile"SubWep_Ammo"GetPVarInt(playerid,"SubWep_Ammo"));
    
dini_IntSet(playerfile"MeleeWep_Ammo"GetPVarInt(playerid,"MeleeWep_Ammo")); 
The probelm I'm having is, how should I save the ammo, I have weapon saving handled but the Ammo I'm having problems.
If I used GetPlayerWeaponData Wouldn't that cause people to beable to edit the Ammo with a program, like cheat engine?

Second Question - Never mind, Was pointed out to look at Style lists
Is there a Tutorial for making Shops for Weapons, and other such items?

Thanks for reading.
Reply
#2

You dont really need a tut, just for weapons, check out dialogs, style list would help you out
Reply
#3

Quote:
Originally Posted by Anthonyx3'
Посмотреть сообщение
You dont really need a tut, just for weapons, check out dialogs, style list would help you out
Ok thanks, Any idea about my first Question?
Reply
#4

Yeah try using getplayerweapondata, you cant really hack to adjust your playerfile, also maybe getplayerweapon
Reply
#5

Ok, does this look ok?
Код HTML:
GetWeaponAmmo(playerid,weapon)
{
    new weapons[13][2];
	for (new i = 0; i < 13; i++)
	{
	    GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
	    if(weapons[i][0] == weapon)
	    return weapons[i][1];
	}
	return 0;
}
Saving:
Код HTML:
	dini_IntSet(playerfile, "PrimWep_Ammo", GetWeaponAmmo(playerid,GetPVarInt(playerid,"PrimWep")));
	dini_IntSet(playerfile, "SubWep_Ammo", GetWeaponAmmo(playerid,GetPVarInt(playerid,"SubWep_Ammo")));
	dini_IntSet(playerfile, "MeleeWep_Ammo",  GetWeaponAmmo(playerid,GetPVarInt(playerid,"MeleeWep_Ammo")));
Edit:
PrimWep_Ammo=198
SubWep_Ammo=100
MeleeWep_Ammo=1
turns into:
PrimWep_Ammo=197
SubWep_Ammo=0
MeleeWep_Ammo=0

I'm guessing it only gets the ammo of the weapon im using?
Edit:
Nvm it sitll only saves prim weapon, even when i use the sub.
Edit:
Oh, I'm dumb.
I had it as:
Код HTML:
	dini_IntSet(playerfile, "PrimWep_Ammo", GetWeaponAmmo(playerid,GetPVarInt(playerid,"PrimWep")));
	dini_IntSet(playerfile, "SubWep_Ammo", GetWeaponAmmo(playerid,GetPVarInt(playerid,"SubWep_Ammo")));
	dini_IntSet(playerfile, "MeleeWep_Ammo", GetWeaponAmmo(playerid,GetPVarInt(playerid,"MeleeWep_Ammo")));
Instead of:
Код HTML:
	dini_IntSet(playerfile, "PrimWep_Ammo", GetWeaponAmmo(playerid,GetPVarInt(playerid,"PrimWep")));
	dini_IntSet(playerfile, "SubWep_Ammo", GetWeaponAmmo(playerid,GetPVarInt(playerid,"SubWep")));
	dini_IntSet(playerfile, "MeleeWep_Ammo", GetWeaponAmmo(playerid,GetPVarInt(playerid,"MeleeWep")));
Reply
#6

I was able to change my ammo from 180 to 1000 with cheat engine, and it saved.

Anyone know a fix?
Reply


Forum Jump:


Users browsing this thread: 7 Guest(s)