SA-MP Forums Archive
I need help - 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: I need help (/showthread.php?tid=68368)



I need help - GTA_Rules - 09.03.2009

Hai,

I have this gang script. I want the Ballas to go steal Grove's car and bring it to some checkpoint and the other way around. Ofcourse I don't want the Ballas to steal their own car and drive it somewhere far away from Grove street.

So I made this script that checks if it's Grove or Ballas but fails ingame.

http://i42.tinypic.com/fn7pzo.png

It should only give the message 'You can't steal your own gang car". The others should show when somebody from the other gang steals the car.

Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
  if(newstate == PLAYER_STATE_DRIVER)
  {
    new numero = GetPlayerVehicleID(playerid);
    if(numero == BallasVeh)
        {
        if(gTeam[playerid] == TEAM_BALLA){
        SendClientMessage(playerid,0xFF0000AA, "You can't steal your own gang car!");
        RemovePlayerFromVehicle(playerid);
        }else
        {
        if(gTeam[playerid] == TEAM_GROVE){
        SetPlayerCheckpoint(playerid, 2412.2483,-1854.1670,1.1559, 6.5);
        SendClientMessage(playerid, 0x33AA33AA, "You have stolen the Grove's gang vehicle! Get it to the checkpoint!");
        SendClientMessageToAll(0xFF0000AA, "*** Somebody is stealing the Grove's gang vehicle! ***");
        }
       }
    }
  }
  if(newstate == PLAYER_STATE_DRIVER)
  {
    new numero = GetPlayerVehicleID(playerid);
    if(numero == GroveVeh)
        {
        {
        if(gTeam[playerid] == TEAM_GROVE)
        SendClientMessage(playerid,0xFF0000AA, "You can't steal your own gang car!");
        RemovePlayerFromVehicle(playerid);
        }
        {
        if(gTeam[playerid] == TEAM_BALLA)
        SetPlayerCheckpoint(playerid, 2412.2483,-1854.1670,1.1559, 6.5);
        SendClientMessage(playerid, 0x33AA33AA, "You have stolen the Grove's gang vehicle! Get it to the checkpoint!");
        SendClientMessageToAll(0xFF0000AA, "*** Somebody is stealing the Grove's gang vehicle! ***");
        }
    }
  }
  return 1;
}
Thanks!


Re: I need help - MenaceX^ - 09.03.2009

Message doesn't appear? What is the problem?


Re: I need help - GTA_Rules - 09.03.2009

No. As you can see in the pic the 'you have stolen...' and 'sombody has stolen...' messages appear. And they shouldn't. Only the 'you cant steal your own ...' message should.


Re: I need help - GTA_Rules - 09.03.2009

Sry for the double post, I really need help.

Anyone?


Re: I need help - GTA_Rules - 10.03.2009

?


Re: I need help - [RP]Rav - 10.03.2009

some messages are double too (both teams steal groves car?), try to see what happens if you steal the other teams vehicle


Re: I need help - ICECOLDKILLAK8 - 10.03.2009

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
  if(newstate == PLAYER_STATE_DRIVER)
  {
    new numero = GetPlayerVehicleID(playerid);
    if(numero == BallasVeh)
        {
        if(gTeam[playerid] == TEAM_BALLA){
        SendClientMessage(playerid,0xFF0000AA, "You can't steal your own gang car!");
        RemovePlayerFromVehicle(playerid);
        }else
        {
        if(gTeam[playerid] == TEAM_GROVE){
        SetPlayerCheckpoint(playerid, 2412.2483,-1854.1670,1.1559, 6.5);
        SendClientMessage(playerid, 0x33AA33AA, "You have stolen the Grove's gang vehicle! Get it to the checkpoint!");
        SendClientMessageToAll(0xFF0000AA, "*** Somebody is stealing the Grove's gang vehicle! ***");
        }
       }
    }
    else if(numero == GroveVeh)
        {
        {
        if(gTeam[playerid] == TEAM_GROVE)
        SendClientMessage(playerid,0xFF0000AA, "You can't steal your own gang car!");
        RemovePlayerFromVehicle(playerid);
        }
        {
        if(gTeam[playerid] == TEAM_BALLA)
        SetPlayerCheckpoint(playerid, 2412.2483,-1854.1670,1.1559, 6.5);
        SendClientMessage(playerid, 0x33AA33AA, "You have stolen the Grove's gang vehicle! Get it to the checkpoint!");
        SendClientMessageToAll(0xFF0000AA, "*** Somebody is stealing the Grove's gang vehicle! ***");
        }
    }
  }
  return 1;
}
Try that


Re: I need help - GTA_Rules - 10.03.2009

EDIT: Fireburn fixed it .

This can be locked .

The code if anybody could use it: (Thanks to Fireburn!)

Quote:

public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
new numero = GetPlayerVehicleID(playerid);
if(numero == BallasVeh)
{
if(gTeam[playerid] == TEAM_BALLA)
{
SendClientMessage(playerid,0xFF0000AA, "You can't steal your own gang car!");
RemovePlayerFromVehicle(playerid);
}
else if(gTeam[playerid] == TEAM_GROVE)
{
SetPlayerCheckpoint(playerid, 2412.2483,-1854.1670,1.1559, 6.5);
SendClientMessage(playerid, 0x33AA33AA, "You have stolen Ballas' gang vehicle! Get it to the checkpoint!");
SendClientMessageToAll(0xFF0000AA, "*** Somebody is stealing Ballas' gang vehicle! ***");
}
}
else if(numero == GroveVeh)
{
if(gTeam[playerid] == TEAM_GROVE)
{
SendClientMessage(playerid,0xFF0000AA, "You can't steal your own gang car!");
RemovePlayerFromVehicle(playerid);
}
else if(gTeam[playerid] == TEAM_BALLA)
{
SetPlayerCheckpoint(playerid, 2412.2483,-1854.1670,1.1559, 6.5);
SendClientMessage(playerid, 0x33AA33AA, "You have stolen the Grove's gang vehicle! Get it to the checkpoint!");
SendClientMessageToAll(0xFF0000AA, "*** Somebody is stealing the Grove's gang vehicle! ***");
}
}
}
else if(newstate == PLAYER_STATE_ONFOOT)
{
DisablePlayerCheckpoint(playerid);
}
return 1;
}