public OnPlayerPickUpPickup -
yelkreb - 02.03.2009
This is the code:
public OnPlayerPickUpPickup(playerid, pickupid)
{
AddStaticPickup(1272, 2, -83.0494, 9.7471, 3.1172);
new tag[10], name[30];
GetPlayerName(playerid, name, 30);
format(tag, 10, "[Y]", tag);
Teleport(playerid, 2324.419921, -1145.568359, 1050.710083, 88.2612, 12, false);
if(strfind(name, tag, true) == -1)
{
SendClientMessage(playerid, COLOR_GREEN, "You cannot teleport to this place as you are not in The Yardies gang.");
return 1;
}
return Teleport(playerid, 2324.419921, -1145.568359, 1050.710083, 88.2612, 12, false);
}
}
it compiles, however, when I enter every single pickup whether it is a weapon or armour or any other pickup it teleports me to 2324.419921, -1145.568359, 1050.710083, 88.2612. Help?
Re: public OnPlayerPickUpPickup -
Danut - 02.03.2009
pawn Код:
new H&A;
// OnPlayerPickupPickUp
if (pickupid == H&A)
{
// your command
}
//OnGameModeInit
H&A = CreatePickup(1239, 2, X,Y,Z);
Re: public OnPlayerPickUpPickup -
yelkreb - 02.03.2009
And what H&A supposed to be? I tried it, look at these error messages:
C:\Program Files\Rockstar Games\GTA San Andreas\gamemodes\ponyfarming.pwn(33) : error 001: expected token: ";", but found "&"
C:\Program Files\Rockstar Games\GTA San Andreas\gamemodes\ponyfarming.pwn(49) : error 017: undefined symbol "A"
C:\Program Files\Rockstar Games\GTA San Andreas\gamemodes\ponyfarming.pwn(1084) : error 017: undefined symbol "A"
Re: public OnPlayerPickUpPickup -
Danut - 02.03.2009
change the H&A in HealthArmour , or OTHER NAME
Re: public OnPlayerPickUpPickup -
yelkreb - 02.03.2009
I tried, and it's still same.
Re: public OnPlayerPickUpPickup -
Rks25 - 02.03.2009
Show the code YOU are trying to compile.
Re: public OnPlayerPickUpPickup -
yelkreb - 03.03.2009
new H&A;
public OnPlayerPickUpPickup(playerid, pickupid)
{
if (pickupid == H&A)
AddStaticPickup(1272, 2, -83.0494, 9.7471, 3.1172);
new tag[10], name[30];
GetPlayerName(playerid, name, 30);
format(tag, 10, "[Y]", tag);
Teleport(playerid, 2324.419921, -1145.568359, 1050.710083, 88.2612, 12, false);
if(strfind(name, tag, true) == -1)
{
SendClientMessage(playerid, COLOR_GREEN, "You cannot teleport to this place as you are not in The Yardies gang.");
return 1;
}
return Teleport(playerid, 2324.419921, -1145.568359, 1050.710083, 88.2612, 12, false);
}
}
//OnGameModeInit
H&A = CreatePickup(1272, 2, -83.0494, 9.7471, 3.1172);
there you go
Re: public OnPlayerPickUpPickup -
Popz - 03.03.2009
Quote:
Originally Posted by Danut
change the H&A in HealthArmour , or OTHER NAME
|
Do that. It won't compile if the variable name contains an unrecognised character, e.g. an '&'.
Re: public OnPlayerPickUpPickup -
yelkreb - 03.03.2009
Just tried, it's didn't work.
Re: public OnPlayerPickUpPickup -
Popz - 03.03.2009
Quote:
Originally Posted by yelkreb
Just tried, it's didn't work. 
|
post the code you used. also, use pastebin.
Re: public OnPlayerPickUpPickup -
yelkreb - 03.03.2009
Popz, I used
new HealthArmour; and
HalthArmour = CreatePickup(1272, 2, -83.0494, 9.7471, 3.1172);
The rest:
http://pastebin.com/m3d2e5fef
Re: public OnPlayerPickUpPickup -
yelkreb - 03.03.2009
public OnPlayerPickUpPickup(playerid, pickupid)
{
if (pickupid == HealthArmour)
AddStaticPickup(1272, 2, -83.0494, 9.7471, 3.1172);
new tag[10], name[30];
GetPlayerName(playerid, name, 30);
format(tag, 10, "[Y]", tag);
Teleport(playerid, 2324.419921, -1145.568359, 1050.710083, 88.2612, 12, false);
if(strfind(name, tag, true) == -1)
{
SendClientMessage(playerid, COLOR_GREEN, "You cannot teleport to this place as you are not in The Yardies gang.");
return 1;
}
return Teleport(playerid, 2324.419921, -1145.568359, 1050.710083, 88.2612, 12, false);
}
What am I doing wrong?
Re: public OnPlayerPickUpPickup -
yelkreb - 03.03.2009
ok I tried this aswell:
public OnPlayerPickUpPickup(playerid, pickupid)
{
if (pickupid == HealthArmour)
{
new tag[10], name[30];
GetPlayerName(playerid, name, 30);
format(tag, 10, "[Y]", tag);
Teleport(playerid, 2324.419921, -1145.568359, 1050.710083, 88.2612, 12, false);
if(strfind(name, tag, true) == -1)
}
SendClientMessage(playerid, COLOR_GREEN, "You cannot teleport to this place as you are not in The Yardies gang.");
return 1;
}
return Teleport(playerid, 2324.419921, -1145.568359, 1050.710083, 88.2612, 12, false);
}
And it gave me one error: C:\Program Files\Rockstar Games\GTA San Andreas\gamemodes\ponyfarming.pwn(1095) : error 029: invalid expression, assumed zero
Re: public OnPlayerPickUpPickup -
krisk - 03.03.2009
Whats on line 1095, and a few lines in front, plus a few lines after?
Re: public OnPlayerPickUpPickup -
-Sneaky- - 03.03.2009
pawn Код:
// on top
new YardiesPickup;
// ongamemodeinit
YardiesPickup = CreatePickup(1272, 2, -83.0494, 9.7471, 3.1172);
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == YardiesPickup)
{
new
tag[10], name[30];
GetPlayerName(playerid, name, 30);
format(tag, 10, "[Y]", tag);
if(strfind(name, tag, true) == -1)
{
SendClientMessage(playerid, COLOR_GREEN, "You cannot teleport to this place as you are not in The Yardies gang.");
return 1;
}
else return Teleport(playerid, 2324.419921, -1145.568359, 1050.710083, 88.2612, 12, false);
}
return 1;
}
Try this..
You should really learn some basics first, read the wiki>
https://sampwiki.blast.hk/wiki/Scripting_Basics .. like this you wont get anywhere.
Re: public OnPlayerPickUpPickup -
yelkreb - 03.03.2009
I got it fixed, thanks to other friend. Thanks for your time the people who tried to help, much appreciated, close this please.