team car jack
#1

how to move a player +10 z up if he tries to jack a team mate?
i got something like this:

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new Float, Float:y, Float:z;
if(gTeam[playerid] == TEAM_USA)
{
//i dont know what to put here
{
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(playerid, x, y, z+10);
}
}
return 1;
}

but the rest of the code is ok right?
Reply
#2

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
  for(new i = 0; i < MAX_PLAYERS; i ++)
  {
    if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i) && i != playerid)
    {
      if(gTeam[i] == gTeam[playerid] && GetPlayerVehicleID(i) == vehicleid)
      {
        new
          Pos[3];

        GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
        SetPlayerPos(playerid, Pos[0], Pos[1], Pos[2] + 10);
        SendClientMessage(playerid, COLOR, "Don't jack team mates!");
      }
    }
  }
  return 1;
}
Reply
#3

Quote:
Originally Posted by SAWC™
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
  for(new i = 0; i < MAX_PLAYERS; i ++)
  {
    if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i) && i != playerid)
    {
      if(gTeam[i] == gTeam[playerid] && GetPlayerVehicleID(i) == vehicleid)
      {
        new
          Pos[3];

        GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
        SetPlayerPos(playerid, Pos[0], Pos[1], Pos[2] + 10);
        SendClientMessage(playerid, COLOR, "Don't jack team mates!");
      }
    }
  }
  return 1;
what is this? can you explain it a little? because it gives me erros not including "COLOR"

Reply
#4

Код:
SendClientMessage(playerid, COLOR, "Don't jack team mates!");
Edit the word "COLOR" of that line, into a heximal color which you either already defined, or just a hex value with 0x in front, and AA at the back.

Red: 0xFF0000AA.
Reply
#5

Quote:
Originally Posted by VonLeeuwen
Код:
SendClientMessage(playerid, COLOR, "Don't jack team mates!");
Edit the word "COLOR" of that line, into a heximal color which you either already defined, or just a hex value with 0x in front, and AA at the back.

Red: 0xFF0000AA.
Lol, i mean it gives me errors other then "color".
C:\Users\Max\Desktop\server\gamemodes\ww3.pwn(384) : error 001: expected token: ";", but found "-identifier-"
C:\Users\Max\Desktop\server\gamemodes\ww3.pwn(384) : warning 213: tag mismatch
C:\Users\Max\Desktop\server\gamemodes\ww3.pwn(384) : warning 213: tag mismatch
C:\Users\Max\Desktop\server\gamemodes\ww3.pwn(384) : warning 213: tag mismatch
Reply
#6

Sorry about that, read it wrong

Show us line 384 please
Reply
#7

its ok i should have explained it better,
oh yea and this: warning 219: local variable "Pos" shadows a variable at a preceding level

code:

383: new Pos[3]
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
385: SetPlayerPos(playerid, Pos[0], Pos[1], Pos[2] + 10);
SendClientMessage(playerid, 0xFF0000AA, "Commander: team car jacking isn't allowed here !!");

i used Pos somewhere else to spawn a car but i dont know if that effects warning 219.
Reply
#8

You have this?

383: new Pos[3]
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
385: SetPlayerPos(playerid, Pos[0], Pos[1], Pos[2] + 10);
SendClientMessage(playerid, 0xFF0000AA, "Commander: team car jacking isn't allowed here !!");

If yes, just remove line 383: new Pos[3]

This will fix all warnings, but, just for your information, if you didn't use Pos[3] yet, you had to add a ; behind new Pos[3].

So, just remove new Pos[3] now
Reply
#9

Quote:
Originally Posted by VonLeeuwen
You have this?

383: new Pos[3]
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
385: SetPlayerPos(playerid, Pos[0], Pos[1], Pos[2] + 10);
SendClientMessage(playerid, 0xFF0000AA, "Commander: team car jacking isn't allowed here !!");

If yes, just remove line 383: new Pos[3]

This will fix all warnings, but, just for your information, if you didn't use Pos[3] yet, you had to add a ; behind new Pos[3].

So, just remove new Pos[3] now
C:\Users\Max\Desktop\server\gamemodes\ww3.pwn(383) : error 035: argument type mismatch (argument 2)
C:\Users\Max\Desktop\server\gamemodes\ww3.pwn(384) : error 035: argument type mismatch (argument 2)
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
Reply
#10

Ok, so Pawn wants to do it my/the noobish way? He can get it, try this:

Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
  for(new i = 0; i < MAX_PLAYERS; i ++)
  { 
    if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i) && i != playerid)
    {
      if(gTeam[i] == gTeam[playerid] && GetPlayerVehicleID(i) == vehicleid)
      {
        new 
          Float:x, Float:y, Float:z;

        GetPlayerPos(playerid,x, y, z);
        SetPlayerPos(playerid, x, y, z + 10);
        SendClientMessage(playerid, COLOR, "Don't jack team mates!");
      }
    }
  }
  return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)