Posts: 5,240
Threads: 361
Joined: Jun 2008
I see a lot of stuff you're doing wrong
Anyway, let me explain you a few stuff. First of all no need to define #pickupid and #playerid etc. These are parameters in the callback. Plus Pawn is a case-sensitive scripting language, using Public won't work, use public (no capital).
Also, read this: http://wiki.sa-mp.com/wiki/PickupGuide
Euhm, I see a lot more going wrong, when defining something, don't use new something, use new something; (don't forget the ';').
I probably forgot a lot, but I'm busy. Reading this will help a lot: http://wiki.sa-mp.com/wiki/PickupGuide and maybe: http://wiki.sa-mp.com/wiki/Scripting_Basics.
Good luck with it, and feel free to post here if you have more questions.
|
Posts: 1,953
Threads: 103
Joined: Dec 2007
Aside from that theres still the main problem, why the pickup isn't showing.
Its because you didn't assign the name/"new <blah>" things to the pickup, It tells you in the pickup guide.
For example:
Code: new retarded;
retarded = AddStaticPickup(350, 2, 2100.8, 2168.8, 13.4);
( This goes in OnGameModeInit )
if(pickupid == Sawnoff) {
GivePlayerWeapon(playerid, 350, 100);
(This goes in OnPlayerPickUpPickUp )
Also this is un-needed
Code: if(pickupid == Health) {
GivePlayerHealth(playerid, 1240, 100);
if(pickupid == Health) {
GivePlayerHealth(playerid, 1240, 100);
if(pickupid == Armor) {
GivePlayerArmor(playerid, 1242, 100);
The pickup itself gives you health anyway.
|
Posts: 3,274
Threads: 222
Joined: Jul 2008
05-07-2009, 07:31 PM
(This post was last modified: 05-07-2009, 07:39 PM by Mark)
speedruntrainer, try an easier way of adding pickups, using one line and I'd suggest to put the lines under AddStaticVehicle and CreateObject or whatever, but note that they must be under public OnGameModeInit()
AddStaticPickup( 371, 2, 2909.068604, -1666.524658, 872.300903);
AddStaticPickup( 371, 2, 2909.068604, -1666.524658, 872.300903);
AddStaticPickup( 371, 2, 2909.068604, -1666.524658, 872.300903);
Like this.
Red stands for object id - for example, if you want to have health as a pickup, then no need to add a new line like GivePlayerHealth or something, because it will automatically give you health when you pick it up, as FarePak told you. You can find pickup ids here, and weapon ids here.
Green stands for pickup types - like the number 2 means when you collect the pickup, it will respawn after few seconds. You can find different types of pickups here (scroll down to the bottom).
Blue stands for coordinates - you will have to get them yourself.
FarePak wrote almost the same thing as I just did, but I just wanted to explain what the different ids mean and where you can get a full list of them, since you said you are a beginner, hope you don't mind
|
Posts: 452
Threads: 75
Joined: Dec 2008
05-08-2009, 01:32 AM
(This post was last modified: 05-08-2009, 01:35 AM by speedruntrainer)
:-X what's wrong with this? o.O
Code: #include <a_samp>
new Health;
new Health2;
new Armor;
new Sawnoff;
new Tec9;
public OnGameModeInit()
{
Health = CreatePickup(1240, 2, 2000.7, 1568.0, 15.3); //Health
Health2 = CreatePickup(1240, 2, 2099.9, 2186.5, 13.4); //Health
Armor = CreatePickup(1242, 2, 2100, 2184,.3, 13.4); //Armor
Sawnoff = CreatePickup(350, 2, 2100.8, 2168.8, 13.4); //Sawnoff
Tec9 = CreatePickup(372, 2, 2100.9, 2170.9, 10.8); //Tec9
return 1;
}
public OnPlayerPickupPickup(playerid, pickupid);
{
if(pickupid == Health)
{
GivePlayerHealth(playerid, 1240, 100);
}
else if(pickupid == Health2)
{
GivePlayerHealth(playerid, 1240, 100);
}
else if(pickupid == Armor)
{
GivePlayerArmor(playerid, 1242, 100);
}
else if(pickupid == Sawnoff)
{
GivePlayerWeapon(playerid, 350, 100);
}
else if(pickupid == Tec9)
{
GivePlayerWeapon(playerid, 372, 1000);
}
return 1;
Code: C:\Users\Nel\Desktop\Mijn spullen\GTA Games\Server test gta\filterscripts\pickups.pwn(14) : error 001: expected token: "-identifier-", but found "-integer value-"
C:\Users\Nel\Desktop\Mijn spullen\GTA Games\Server test gta\filterscripts\pickups.pwn(14) : warning 215: expression has no effect
C:\Users\Nel\Desktop\Mijn spullen\GTA Games\Server test gta\filterscripts\pickups.pwn(14) : warning 215: expression has no effect
C:\Users\Nel\Desktop\Mijn spullen\GTA Games\Server test gta\filterscripts\pickups.pwn(14) : error 001: expected token: ";", but found ")"
C:\Users\Nel\Desktop\Mijn spullen\GTA Games\Server test gta\filterscripts\pickups.pwn(14) : error 029: invalid expression, assumed zero
C:\Users\Nel\Desktop\Mijn spullen\GTA Games\Server test gta\filterscripts\pickups.pwn(14) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
4 Errors.
|
Posts: 1,953
Threads: 103
Joined: Dec 2007
|
Posts: 3,274
Threads: 222
Joined: Jul 2008
(05-08-2009, 01:32 AM)speedruntrainer link Wrote: :-X what's wrong with this? o.O
Code: #include <a_samp>
new Health;
new Health2;
new Armor;
new Sawnoff;
new Tec9;
public OnGameModeInit()
{
Health = CreatePickup(1240, 2, 2000.7, 1568.0, 15.3); //Health
Health2 = CreatePickup(1240, 2, 2099.9, 2186.5, 13.4); //Health
Armor = CreatePickup(1242, 2, 2100, 2184,.3, 13.4); //Armor
Sawnoff = CreatePickup(350, 2, 2100.8, 2168.8, 13.4); //Sawnoff
Tec9 = CreatePickup(372, 2, 2100.9, 2170.9, 10.8); //Tec9
return 1;
}
public OnPlayerPickupPickup(playerid, pickupid);
{
if(pickupid == Health)
{
GivePlayerHealth(playerid, 1240, 100);
}
else if(pickupid == Health2)
{
GivePlayerHealth(playerid, 1240, 100);
}
else if(pickupid == Armor)
{
GivePlayerArmor(playerid, 1242, 100);
}
else if(pickupid == Sawnoff)
{
GivePlayerWeapon(playerid, 350, 100);
}
else if(pickupid == Tec9)
{
GivePlayerWeapon(playerid, 372, 1000);
}
return 1;
Code: C:\Users\Nel\Desktop\Mijn spullen\GTA Games\Server test gta\filterscripts\pickups.pwn(14) : error 001: expected token: "-identifier-", but found "-integer value-"
C:\Users\Nel\Desktop\Mijn spullen\GTA Games\Server test gta\filterscripts\pickups.pwn(14) : warning 215: expression has no effect
C:\Users\Nel\Desktop\Mijn spullen\GTA Games\Server test gta\filterscripts\pickups.pwn(14) : warning 215: expression has no effect
C:\Users\Nel\Desktop\Mijn spullen\GTA Games\Server test gta\filterscripts\pickups.pwn(14) : error 001: expected token: ";", but found ")"
C:\Users\Nel\Desktop\Mijn spullen\GTA Games\Server test gta\filterscripts\pickups.pwn(14) : error 029: invalid expression, assumed zero
C:\Users\Nel\Desktop\Mijn spullen\GTA Games\Server test gta\filterscripts\pickups.pwn(14) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
4 Errors.
Could you paste your full filterscript or gamemode or whatever it is to pastebin.com? That way it will be easier to find the errors for you.
|
Posts: 452
Threads: 75
Joined: Dec 2008
|
Posts: 1,953
Threads: 103
Joined: Dec 2007
Is this a filterscript or a gamemode?
|
Posts: 452
Threads: 75
Joined: Dec 2008
A filterscript. I just add pickups to my server.
|
Posts: 1,953
Threads: 103
Joined: Dec 2007
05-08-2009, 02:23 PM
(This post was last modified: 05-08-2009, 02:34 PM by FarePak)
Why don't you just add the pickups to your main script?
Edit: http://pastebin.com/f1a7fcbe6
There you go.
I fixed everything, just look at the differences between mine and yours and you'll get it.
|
|