SA-MP Forums Archive
can u help me for put command into an object - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: can u help me for put command into an object (/showthread.php?tid=204126)



can u help me for put command into an object - Petrikk - 28.12.2010

hi im stuck on a thing sry for my englisch its not very good btw
im having an problem i have my weapon list ingame you can buy some with the command /guns
okee but idont want that every player can buy what he wants
soo i need some object (some ppl saying its a briefcase) i want that to in my server
look if u are in my game and youre on base standing a bit.. and you want weapon just walk into the object
and poooof ur got a weaponmenu,,

here you got my filterscript from the weapon menu plss
stay my credits on it if you use it TY!!!!

Quote:

// This is a comment
// uncomment the line below if you want to write a filterscript
#define FILTERSCRIPT

#include <a_samp>

#if defined FILTERSCRIPT
#define Dialog_Weaps 1
#define red 0xff0000a7
#define COLOR_GREEN 0x33AA33AA

public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" WeaponShop Made By Petrikk");
print("--------------------------------------\n");
return 1;
}

public OnFilterScriptExit()
{
return 1;
}

#else

main()
{
print("\n----------------------------------");
print(" WeaponShop Made By Petrikk");
print("----------------------------------\n");
}

#endif



public OnGameModeExit()
{
return 1;
}



public OnPlayerConnect(playerid)
{
return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
return 1;
}

public OnPlayerSpawn(playerid)
{
return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}

public OnVehicleSpawn(vehicleid)
{
return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}

public OnPlayerText(playerid, text[])
{
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/guns", cmdtext, true, 10) == 0)
{
ShowPlayerDialog(playerid,Dialog_Weaps,2,"Choose a Weapon","nHealth & Armour $10000\nKnife $600\nKatana $600\nGrenade $5000\nTear Gas $4000\nMolotov Cocktails $7000\nSilenced 9mm $2000\nDesert Eagle $2000\nSawn-off Shotgun $2000\nCombat Shotgun $2000\nSMG $2000\nUZI $2500\nTec-9 $3500\nAK-47 $3500\nM4 $3500\nSniper Rifle $3500\nParachute $500\nPizza $Free","Buy","Cancel");


return 1;
}
return 0;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
return 1;
}

public OnRconCommand(cmd[])
{
return 1;
}

public OnPlayerRequestSpawn(playerid)
{
return 1;
}

public OnObjectMoved(objectid)
{
return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
return 1;
}

public OnPlayerExitedMenu(playerid)
{
return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
return 1;
}

public OnPlayerUpdate(playerid)
{
return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid==Dialog_Weaps)
{
if(response)
{
if(listitem==17)
{
if(GetPlayerMoney(playerid) < 1000)
{
SendClientMessage(playerid,red, "You cant offer A Pizza!");
return 1;
}
GivePlayerMoney(playerid, -1000);
SendClientMessage(playerid, COLOR_GREEN, "Hmmmm That Pizza Was Nice&Sweeeeeeet!");
GivePlayerWeapon(playerid, 0, 1);
return 1;
}
if(listitem==1)
{
if(GetPlayerMoney(playerid) < 600)
{
SendClientMessage(playerid,red, "The Knife costs $600.You haven't enough money!");
return 1;
}
GivePlayerMoney(playerid, -600);
SendClientMessage(playerid, COLOR_GREEN, "You bought Knife!");
GivePlayerWeapon(playerid, 4, 1);
return 1;
}
if(listitem==2)
{
if(GetPlayerMoney(playerid) < 600)
{
SendClientMessage(playerid,red, "The Katana costs $600.You haven't enough money!");
return 1;
}
GivePlayerMoney(playerid, -600);
SendClientMessage(playerid, COLOR_GREEN, "You bought Katana!");
GivePlayerWeapon(playerid, 8, 1);
return 1;
}
if(listitem==3)
{
if(GetPlayerMoney(playerid) < 1000)
{
SendClientMessage(playerid,red, "The Grenades costs 25 nades each set $5000.You haven't enough money!");
return 1;
}
GivePlayerMoney(playerid, -1000);
SendClientMessage(playerid, COLOR_GREEN, "You bought A Set Of 25 Grenades!");
GivePlayerWeapon(playerid, 16, 25);
return 1;
}
if(listitem==4)
{
if(GetPlayerMoney(playerid) < 4000)
{
SendClientMessage(playerid,red, "The Tear Gas costs 25 nades each set $4000.You haven't enough money!");
return 1;
}
GivePlayerMoney(playerid, -4000);
SendClientMessage(playerid, COLOR_GREEN, "You bought A Set Of 25 Teargas nades!");
GivePlayerWeapon(playerid, 17, 25);
return 1;
}
if(listitem==5)
{
if(GetPlayerMoney(playerid) < 7000)
{
SendClientMessage(playerid,red, "The Molotov Cocktails costs 25 Bottles each set $7000.You haven't enough money!");
return 1;
}
GivePlayerMoney(playerid, -7000);
SendClientMessage(playerid, COLOR_GREEN, "You bought A Set Of 25 Molotovs Coctails!");
GivePlayerWeapon(playerid, 18, 25);
return 1;
}
if(listitem==6)
{
if(GetPlayerMoney(playerid) < 2000)
{
SendClientMessage(playerid,red,"The Silenced 9mm costs $150000!You haven't enough money!");
return 1;
}
GivePlayerMoney(playerid,-2000);
SendClientMessage(playerid,COLOR_GREEN,"You bought Silenced 9mm!");
GivePlayerWeapon(playerid,23, 500);
return 1;
}
if(listitem==7)
{
if(GetPlayerMoney(playerid) < 2000)
{
SendClientMessage(playerid,red,"The Desert Eagle costs $2000!You haven't enough money!");
return 1;
}
GivePlayerMoney(playerid,-2000);
SendClientMessage(playerid,COLOR_GREEN,"You bought Desert Eagle!");
GivePlayerWeapon(playerid,24, 500);
return 1;
}
if(listitem==
{
if(GetPlayerMoney(playerid) < 2000)
{
SendClientMessage(playerid,red,"The Sawn-off Shotgun costs $2000!You haven't enough money!");
return 1;
}
GivePlayerMoney(playerid,-2000);
SendClientMessage(playerid,COLOR_GREEN,"You bought Sawn-off Shotgun!");
GivePlayerWeapon(playerid,26, 500);
return 1;
}
if(listitem==9)
{
if(GetPlayerMoney(playerid) < 2000)
{
SendClientMessage(playerid,red,"The Combat Shotgun costs $2000!You haven't enough money!");
return 1;
}
GivePlayerMoney(playerid,-2000);
SendClientMessage(playerid,COLOR_GREEN,"You bought Combat Shotgun!");
GivePlayerWeapon(playerid,27, 500);
return 1;
}
if(listitem==10)
{
if(GetPlayerMoney(playerid) < 2000)
{
SendClientMessage(playerid,red,"The SMG costs $2000!You haven't enough money!");
return 1;
}
GivePlayerMoney(playerid,-2000);
SendClientMessage(playerid,COLOR_GREEN,"You bought SMG!");
GivePlayerWeapon(playerid,29, 500);
return 1;
}
if(listitem==11)
{
if(GetPlayerMoney(playerid) < 2500)
{
SendClientMessage(playerid,red,"The UZI costs $2000!You haven't enough money!");
return 1;
}
GivePlayerMoney(playerid,-2500);
SendClientMessage(playerid,COLOR_GREEN,"You bought UZI!");
GivePlayerWeapon(playerid,28, 500);
return 1;
}
if(listitem==12)
{
if(GetPlayerMoney(playerid) < 3500)
{
SendClientMessage(playerid,red,"The Tec-9 costs $3500!You haven't enough money!");
return 1;
}
GivePlayerMoney(playerid,-3500);
SendClientMessage(playerid,COLOR_GREEN,"You bought Tec-9!");
GivePlayerWeapon(playerid,32, 500);
return 1;
}
if(listitem==13)
{
if(GetPlayerMoney(playerid) < 3500)
{
SendClientMessage(playerid,red,"The AK-47 costs $3500!You haven't enough money!");
return 1;
}
GivePlayerMoney(playerid,-3500);
SendClientMessage(playerid,COLOR_GREEN,"You bought AK-47!");
GivePlayerWeapon(playerid,30, 500);
return 1;
}
if(listitem==14)
{
if(GetPlayerMoney(playerid) < 3500)
{
SendClientMessage(playerid,red,"The M4 costs $3500!You haven't enough money!");
return 1;
}
GivePlayerMoney(playerid,-3500);
SendClientMessage(playerid,COLOR_GREEN,"You bought M4!");
GivePlayerWeapon(playerid,31, 500);
return 1;
}
if(listitem==15)
{
if(GetPlayerMoney(playerid) < 3500)
{
SendClientMessage(playerid,red,"The Sniper Rifle costs $3500!You haven't enough money!");
return 1;
}
GivePlayerMoney(playerid,-3500);
SendClientMessage(playerid,COLOR_GREEN,"You bought Sniper Rifle!");
GivePlayerWeapon(playerid,34, 500);
return 1;
}
if(listitem==16)
{
if(GetPlayerMoney(playerid) < 500)
{
SendClientMessage(playerid,red,"The Parachute costs $3500!You haven't enough money!");
return 1;
}
GivePlayerMoney(playerid,-500);
SendClientMessage(playerid,COLOR_GREEN,"You bought Parachute!");
GivePlayerWeapon(playerid,46, 500);
return 1;
}
if(listitem==0)
{

if(GetPlayerMoney(playerid) < 10000)
{
SendClientMessage(playerid,red,"You don't have enough money for heal yourself or buy any armour!");
return 1;
}
GivePlayerMoney(playerid,-10000);
SetPlayerHealth(playerid,100);
SetPlayerArmour(playerid,100);
return 1;

}
}
}
#pragma tabsize 0
return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}
im not a good scripter but i want to learn watching Vidz & tuts on forums
im having the server almost done like 80% of %100
but sometimes u have it too, then you cant figure it out whats wrong
sry if my script not good sorted

byebye


Re: can u help me for put command into an object - _rAped - 28.12.2010

I guess you are thinking off pickups?

OnPlayerPickUpPickup()
CreatePickup()


Re: can u help me for put command into an object - Haydz - 28.12.2010

i'll give you an example

You can find pickup types here https://sampwiki.blast.hk/wiki/PickupTypes
and object ids here https://sampwiki.blast.hk/wiki/Model_ID
pawn Код:
//top of the script
new pickupname;

pickupname = CreatePickup(objectid, typeofpickup,pickupx, pickupy, pickupz, -1);

public OnPlayerPickUpPickup(playerid,pickupid)
{
     if(pickupid == pickupname)
     {
        //add your ShowPlayerDialog here
     }
     return 1;
}



Re: can u help me for put command into an object - Petrikk - 30.12.2010

Quote:
Originally Posted by Hayden_Bruin
Посмотреть сообщение
i'll give you an example

You can find pickup types here https://sampwiki.blast.hk/wiki/PickupTypes
and object ids here https://sampwiki.blast.hk/wiki/Model_ID
pawn Код:
//top of the script
new pickupname;

pickupname = CreatePickup(objectid, typeofpickup,pickupx, pickupy, pickupz, -1);

public OnPlayerPickUpPickup(playerid,pickupid)
{
     if(pickupid == pickupname)
     {
        //add your ShowPlayerDialog here
     }
     return 1;
}
should i write that into my game mode or in my filterscript?
my weaponshop commmand is in filterscript


Re: can u help me for put command into an object - _rAped - 30.12.2010

Quote:
Originally Posted by Petrikk
Посмотреть сообщение
should i write that into my game mode or in my filterscript?
my weaponshop commmand is in filterscript
Then ofcourse your filterscript.


Re: can u help me for put command into an object - Petrikk - 30.12.2010

Quote:
Originally Posted by _rAped
Посмотреть сообщение
Then ofcourse your filterscript.
i putted in my gamemode,, some changes there and some here
and i got it done ty guys

close this topic