[FilterScript] Gun store dialogs (/buyguns)
#1

Deleted
Reply
#2

Hey man, there's a small problem, or maybe it's just me (as I am really new to scripting), I've posted this:

pawn Код:
CMD:buyguns(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 40, 286.148986,-40.644397,1001.515625) || IsPlayerInRangeOfPoint(playerid, 40, 286.800994,-82.547599,1001.515625) || IsPlayerInRangeOfPoint(playerid, 40, 296.919982,-108.071998,1001.515625) || IsPlayerInRangeOfPoint(playerid, 40, 314.820983,-141.431991,999.601562) || IsPlayerInRangeOfPoint(playerid, 40, 316.524993,-167.706985,999.593750))
    ShowPlayerDialog(playerid, DIALOGWEAPONS, DIALOG_STYLE_LIST, "Hello, what guns can I get you?", "Deagle(15k)\nShotgun(2.5k)\nMP5(5k)\nSpas12(170k)\n(50k)\n(60k)\nSniper(150k)\nHalf vest(10k)\nFull vest(20k)","Buy","Cancel");
    return 1;
}
At public OnPlayerCommandText(playerid, cmdtext[])

and I am getting this error messages:

pawn Код:
C:\Users\user\Desktop\Hazard Gaming\HZG V1.0\gamemodes\Hazard.pwn(574) : error 029: invalid expression, assumed zero
C:\Users\user\Desktop\Hazard Gaming\HZG V1.0\gamemodes\Hazard.pwn(574) : error 017: undefined symbol "cmd_buyguns"
C:\Users\user\Desktop\Hazard Gaming\HZG V1.0\gamemodes\Hazard.pwn(574) : error 029: invalid expression, assumed zero
C:\Users\user\Desktop\Hazard Gaming\HZG V1.0\gamemodes\Hazard.pwn(574) : fatal error 107: too many error messages on one line
But besides it you've a small typo here;
pawn Код:
if(GetPlayerMoney(playerid) <1500) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item! chea!");
                SendClientMessage(playerid, COLOR_GRAD, "You bought a deagle for 15k!"); //Purchased for 15,000. (15k)
                GivePlayerMoney(playerid, -1500); // Only 1,500. (1.5k)
                GivePlayerWeapon(playerid,24, 9999999);
Hope I helped, and if ya could guide me through those error messages it will be great!
Reply
#3

Quote:
Originally Posted by CLT
Посмотреть сообщение
Hey man, there's a small problem, or maybe it's just me (as I am really new to scripting), I've posted this:

pawn Код:
CMD:buyguns(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 40, 286.148986,-40.644397,1001.515625) || IsPlayerInRangeOfPoint(playerid, 40, 286.800994,-82.547599,1001.515625) || IsPlayerInRangeOfPoint(playerid, 40, 296.919982,-108.071998,1001.515625) || IsPlayerInRangeOfPoint(playerid, 40, 314.820983,-141.431991,999.601562) || IsPlayerInRangeOfPoint(playerid, 40, 316.524993,-167.706985,999.593750))
    ShowPlayerDialog(playerid, DIALOGWEAPONS, DIALOG_STYLE_LIST, "Hello, what guns can I get you?", "Deagle(15k)\nShotgun(2.5k)\nMP5(5k)\nSpas12(170k)\n(50k)\n(60k)\nSniper(150k)\nHalf vest(10k)\nFull vest(20k)","Buy","Cancel");
    return 1;
}
At public OnPlayerCommandText(playerid, cmdtext[])

and I am getting this error messages:

pawn Код:
C:\Users\user\Desktop\Hazard Gaming\HZG V1.0\gamemodes\Hazard.pwn(574) : error 029: invalid expression, assumed zero
C:\Users\user\Desktop\Hazard Gaming\HZG V1.0\gamemodes\Hazard.pwn(574) : error 017: undefined symbol "cmd_buyguns"
C:\Users\user\Desktop\Hazard Gaming\HZG V1.0\gamemodes\Hazard.pwn(574) : error 029: invalid expression, assumed zero
C:\Users\user\Desktop\Hazard Gaming\HZG V1.0\gamemodes\Hazard.pwn(574) : fatal error 107: too many error messages on one line
But besides it you've a small typo here;
pawn Код:
if(GetPlayerMoney(playerid) <1500) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item! chea!");
                SendClientMessage(playerid, COLOR_GRAD, "You bought a deagle for 15k!"); //Purchased for 15,000. (15k)
                GivePlayerMoney(playerid, -1500); // Only 1,500. (1.5k)
                GivePlayerWeapon(playerid,24, 9999999);
Hope I helped, and if ya could guide me through those error messages it will be great!
Make sure you included zcmd at the top.
#include <zcmd>

Id check here for further help, https://sampforum.blast.hk/showthread.php?tid=91354

(Tho I didn't fully read through your post since its 5am here and im tired.)
Reply
#4

Quote:
Originally Posted by xser
Посмотреть сообщение
Make sure you included zcmd at the top.
#include <zcmd>



(Tho I didn't fully read through your post since its 5am here and im tired.)
It's included, but still doesn't work, but thanks anyways
Reply
#5

Quote:
Originally Posted by CLT
Посмотреть сообщение
It's included, but still doesn't work, but thanks anyways
Then id check here: https://sampforum.blast.hk/showthread.php?tid=91354

For further help.
Reply
#6

Thanks for the correction If you open teamviewer and send me your ID an pass I can try an fix the problem for you
Reply
#7

Check Your Private Message JoshMan
Reply
#8

Quote:
Originally Posted by Josh_Main
Посмотреть сообщение
Thanks for the correction If you open teamviewer and send me your ID an pass I can try an fix the problem for you
I've PMed you, since seems like I am kinda stuck hehe.
Reply
#9

Nice
Reply
#10

nice work
Reply
#11

Not Bad.
Reply
#12

Good Job Man !!
Reply
#13

Thanks!
Reply
#14

Hello i'm new to scripting and I try to use your gunstore script and I get these errors


[QUOTE][C:\Users\BoxBoy\Desktop\Server\gamemodes\gunstore. pwn(375) : warning 217: loose indentation
C:\Users\BoxBoy\Desktop\Server\gamemodes\gunstore. pwn(593) : warning 217: loose indentation
C:\Users\BoxBoy\Desktop\Server\gamemodes\gunstore. pwn(597) : warning 217: loose indentation
C:\Users\BoxBoy\Desktop\Server\gamemodes\gunstore. pwn(637) : warning 217: loose indentation
C:\Users\BoxBoy\Desktop\Server\gamemodes\gunstore. pwn(639) : error 010: invalid function or declaration
C:\Users\BoxBoy\Desktop\Server\gamemodes\gunstore. pwn(641) : error 010: invalid function or declaration
C:\Users\BoxBoy\Desktop\Server\gamemodes\gunstore. pwn(643) : error 010: invalid function or declaration
C:\Users\BoxBoy\Desktop\Server\gamemodes\gunstore. pwn(645) : error 010: invalid function or declaration
C:\Users\BoxBoy\Desktop\Server\gamemodes\gunstore. pwn(647) : error 010: invalid function or declaration
C:\Users\BoxBoy\Desktop\Server\gamemodes\gunstore. pwn(652) : error 010: invalid function or declaration
C:\Users\BoxBoy\Desktop\Server\gamemodes\gunstore. pwn(654) : error 010: invalid function or declaration
C:\Users\BoxBoy\Desktop\Server\gamemodes\gunstore. pwn(659) : error 010: invalid function or declaration
C:\Users\BoxBoy\Desktop\Server\gamemodes\gunstore. pwn(661) : error 010: invalid function or declaration
C:\Users\BoxBoy\Desktop\Server\gamemodes\gunstore. pwn(666) : error 010: invalid function or declaration
C:\Users\BoxBoy\Desktop\Server\gamemodes\gunstore. pwn(66 : error 010: invalid function or declaration
C:\Users\BoxBoy\Desktop\Server\gamemodes\gunstore. pwn(673) : error 010: invalid function or declaration
C:\Users\BoxBoy\Desktop\Server\gamemodes\gunstore. pwn(675) : error 010: invalid function or declaration
C:\Users\BoxBoy\Desktop\Server\gamemodes\gunstore. pwn(680) : error 010: invalid function or declaration
C:\Users\BoxBoy\Desktop\Server\gamemodes\gunstore. pwn(682) : error 010: invalid function or declaration
C:\Users\BoxBoy\Desktop\Server\gamemodes\gunstore. pwn(687) : error 010: invalid function or declaration
C:\Users\BoxBoy\Desktop\Server\gamemodes\gunstore. pwn(689) : error 010: invalid function or declaration
C:\Users\BoxBoy\Desktop\Server\gamemodes\gunstore. pwn(694) : error 010: invalid function or declaration
C:\Users\BoxBoy\Desktop\Server\gamemodes\gunstore. pwn(696) : error 010: invalid function or declaration
C:\Users\BoxBoy\Desktop\Server\gamemodes\gunstore. pwn(699) : error 021: symbol already defined: "GetPlayerArmour"
C:\Users\BoxBoy\Desktop\Server\gamemodes\gunstore. pwn(700) : error 010: invalid function or declaration
C:\Users\BoxBoy\Desktop\Server\gamemodes\gunstore. pwn(705) : error 010: invalid function or declaration
C:\Users\BoxBoy\Desktop\Server\gamemodes\gunstore. pwn(707) : error 010: invalid function or declaration
C:\Users\BoxBoy\Desktop\Server\gamemodes\gunstore. pwn(709) : error 021: symbol already defined: "armour"
C:\Users\BoxBoy\Desktop\Server\gamemodes\gunstore. pwn(711) : error 010: invalid function or declaration
C:\Users\BoxBoy\Desktop\Server\gamemodes\gunstore. pwn(717) : error 054: unmatched closing brace ("}")

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


26 Errors.]




[QUOTE][public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == dregister) //If dialog id is a register dialog
{//then
if(!response) return Kick(playerid); //If they clicked the second button "Quit", we will kick them.
if(response) //if they clicked the first button "Register"
{//then
if(!strlen(inputtext)) //If they didn't enter any password
{// then we will tell to them to enter the password to register
ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_I NPUT,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.\nPlease enter the password!","Register","Quit");
return 1;
}
//If they have entered a correct password for his/her account...
new hashpass[129]; //Now we will create a new variable to hash his/her password
WP_Hash(hashpass,sizeof(hashpass),inputtext);//We will use whirlpool to hash their inputted text
new INI:file = INI_Open(Path(playerid)); // we will open a new file for them to save their account inside of Scriptfiles/Users folder
INI_SetTag(file,"Player's Data");//We will set a tag inside of user's account called "Player's Data"
INI_WriteString(file,"Password",hashpass);//This will write a hashed password into user's account
INI_WriteInt(file,"AdminLevel",0); //Write an integer inside of user's account called "AdminLevel". We will set his level to 0 after he registered.
INI_WriteInt(file,"VIPLevel",0);//As explained above
INI_WriteInt(file,"Money",0);//Write an integer inside of user's account called "Money". We will set their money to 0 after he registered
INI_WriteInt(file,"Scores",0);//Write an integer inside of user's account called "Scores". We will set their score to 0 after he registered
INI_WriteInt(file,"Kills",0);//As explained above
INI_WriteInt(file,"Deaths",0);//As explained above
INI_Close(file);//Now after we've done saving their data, we now need to close the file
SendClientMessage(playerid,-1,"You have been successfully registered");//Tell to them that they have successfully registered a new account
return 1;
}
}
if(dialogid == dlogin) //If dialog id is a login dialog
{//then
if(!response) return Kick(playerid); //If they clicked the second button "Quit", we will kick them.
if(response) //if they clicked the first button "Register"
{//then
new hashpass[129]; //Will create a new variable to hash his/her password
WP_Hash(hashpass,sizeof(hashpass),inputtext); //Will hash inputted password
if(!strcmp(hashpass, pInfo[playerid][Pass], false)) //If they have insert their correct password
{//then
INI_ParseFile(Path(playerid),"loadaccount_%s",.bEx tra = true, .extra = playerid);//We will load his account's data from user's path
SetPlayerScore(playerid,pInfo[playerid][Scores]);//We will get their score inside of his user's account and we will set it here
GivePlayerMoney(playerid,pInfo[playerid][Money]);//As explained above
SendClientMessage(playerid,-1,"Welcome back! You have successfully logged in");//Tell them that they've successfully logged in
}
else //If they've entered an incorrect password
{//then
ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPU T,"Login","Welcome back. This account is registered. \nInsert your password to login to your account.\nIncorrect password!","Login","Quit");//We will tell to them that they've entered an incorrect password
return 1;
}
}
}
if(dialogid == 1)
{
new Float,Float:y,Float:z;
if(response)
{
switch(listitem)
{
case 0:
{
GetPlayerPos(playerid,x,y,z);
CreateVehicle(411,x-3.0,y,z,0.0,1,1,300);
}
case 1:
{
GetPlayerPos(playerid,x,y,z);
CreateVehicle(569,x-3.0,y,z,0.0,1,3,300);
}
case 2:
{
GetPlayerPos(playerid,x,y,z);
CreateVehicle(468,x-3.0,y,z,0.0,1,0,300);
}
case 3:
{
GetPlayerPos(playerid,x,y,z);
CreateVehicle(451,x-3.0,y,z,0.0,0,1,300);
}
case 4:
{
GetPlayerPos(playerid,x,y,z);
CreateVehicle(443,x-3.0,y,z,0.0,1,1,300);
}
case 5:
{
GetPlayerPos(playerid,x,y,z);
CreateVehicle(522,x-3.0,y,z,0.0,1,1,300);
}
}
}
}
return 1;
}
if(dialogid == DIALOGWEAPONS)
{
if(response)
{
switch(listitem)
{
case 0:
{
if(GetPlayerMoney(playerid) <1500) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item! chea!");
SendClientMessage(playerid, COLOR_GRAD, "You bought a deagle for 15k!");
GivePlayerMoney(playerid, -1500);
GivePlayerWeapon(playerid,24, 9999999);
}
case 1:
{
if(GetPlayerMoney(playerid) <2500) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!");
SendClientMessage(playerid, COLOR_GRAD, "You bought a shotgun for 2.5k!");
GivePlayerMoney(playerid, -2500);
GivePlayerWeapon(playerid, 25, 9999999);
}
case 2:
{
if(GetPlayerMoney(playerid) <5000) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!");
SendClientMessage(playerid, COLOR_GRAD, "You bought an MP5 for 5k!");
GivePlayerMoney(playerid, -5000);
GivePlayerWeapon(playerid, 29 ,9999999);
}
case 3:
{
if(GetPlayerMoney(playerid) <170000) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!");
SendClientMessage(playerid, COLOR_GRAD, "You bought a spas12 for 170k!");
GivePlayerMoney(playerid, -170000);
GivePlayerWeapon(playerid, 27, 9999999);
}
case 4:
{
if(GetPlayerMoney(playerid) <50000) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!");
SendClientMessage(playerid, COLOR_GRAD, "You bought an AK-47 for 50k!");
GivePlayerMoney(playerid, -50000);
GivePlayerWeapon(playerid,30 ,9999999);
}
case 5:
{
if(GetPlayerMoney(playerid) <60000) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!");
SendClientMessage(playerid, COLOR_GRAD, "You bought an M4 for 60k!");
GivePlayerMoney(playerid, -60000);
GivePlayerWeapon(playerid, 31, 9999999);
}
case 6:
{
if(GetPlayerMoney(playerid) <150000) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!");
SendClientMessage(playerid, COLOR_GRAD, "You bought a sniper for 150k!");
GivePlayerMoney(playerid, -150000);
GivePlayerWeapon(playerid, 34, 9999999);
}
case 7:
{
if(GetPlayerMoney(playerid) <10000) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!");

new Float:armour;
GetPlayerArmour(playerid, armour);
if(armour == 100) return SendClientMessage(playerid, COLOR_GRAD,"You already have a full vest!");
SendClientMessage(playerid, COLOR_GRAD, "You bought a half vest for 10k!");
GivePlayerMoney(playerid, -10000);
SetPlayerArmour(playerid, 50);
}
case 8:
{
if(GetPlayerMoney(playerid) <20000) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!");

new Float:armour;
GetPlayerArmour(playerid, armour);
if(armour == 100) return SendClientMessage(playerid, COLOR_GRAD, "You already have a full vest!");
SendClientMessage(playerid, COLOR_GRAD, "You bought a full vest for 20k!");
GivePlayerMoney(playerid, -20000);
SetPlayerArmour(playerid, 100);
}

}
return 1;
}
}]


That's my OnDialogResponse any idea why it's not working?
Reply
#15

Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)