public OnPlayerPickUpPickup
#1

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?
Reply
#2

pawn Код:
new H&A;

// OnPlayerPickupPickUp

if (pickupid == H&A)
{
  // your command
}

//OnGameModeInit

H&A = CreatePickup(1239, 2, X,Y,Z);
Reply
#3

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"
Reply
#4

change the H&A in HealthArmour , or OTHER NAME
Reply
#5

I tried, and it's still same.
Reply
#6

Show the code YOU are trying to compile.
Reply
#7

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
Reply
#8

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 '&'.
Reply
#9

Just tried, it's didn't work.
Reply
#10

Quote:
Originally Posted by yelkreb
Just tried, it's didn't work.
post the code you used. also, use pastebin.
Reply
#11

Popz, I used new HealthArmour; and HalthArmour = CreatePickup(1272, 2, -83.0494, 9.7471, 3.1172);

The rest: http://pastebin.com/m3d2e5fef
Reply
#12

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?
Reply
#13

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
Reply
#14

Whats on line 1095, and a few lines in front, plus a few lines after?
Reply
#15

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.
Reply
#16

I got it fixed, thanks to other friend. Thanks for your time the people who tried to help, much appreciated, close this please.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)