help on my jail cmd -
bartje01 - 01.02.2010
Hey guys, I made a jail cmd.
But it doesn't really work you know. I want that it only works if the other play id is this color: 0xFF8000FF (It is orange).
It is working btw. But I just want that it only works if the other player id is orange.
my script:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/jail", cmdtext, true, 10) == 0)
{
new Float:X, Float:Y, Float:Z; //We define floats for the player coordinates
if(GetPlayerColor(playerid) == 0x2641FEAA)
GetPlayerPos(playerid, X, Y, Z); //check what the play coords are.
for(new i = 0; i < MAX_PLAYERS; i++) //This is a 'for' loop, first we define variable 'i' with value of 0, then we check if 'i' is less than the maximum players and if it is, the loop gets run and i gets incremented.
{
if(Jailed[i] == 1)
{
return 1;
}
if(PlayerToPoint(3, i, X, Y, Z) && i != playerid) //Check if the player is near the other
{
SetPlayerPos(i, 263.7086,81.9716,1001.0391);//Set the player position to the jail one. change JailX, etc with the jail coords.
SetPlayerInterior(i, 6); //Set the jailinterior to the jail interior your using.
SetTimerEx("JailTimer", 180000, 0, "i", i);
}
}
return 1;
}
public JailTimer(playerid)
{
if(GetPlayerColor(playerid) == 0xAA3333AA)
Jailed[playerid] = 0;
SetPlayerPos(playerid, 1543.9264,-1675.6503,13.5574); //Set the coords to the ones you want.
return 1;
}
Regards
Re: help on my jail cmd -
MadeMan - 01.02.2010
Try this one:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/jail", cmdtext, true) == 0)
{
if(GetPlayerColor(playerid) == 0x2641FEAA)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(IsPlayerInRangeOfPoint(i, 3, X, Y, Z) && i != playerid && GetPlayerColor(i) == 0xFF8000FF)
{
SetPlayerPos(i, 263.7086,81.9716,1001.0391);
SetPlayerInterior(i, 6);
SetTimerEx("JailTimer", 180000, 0, "i", i);
}
}
}
}
return 1;
}
Re: help on my jail cmd -
bartje01 - 01.02.2010
Quote:
|
Originally Posted by MadeMan
Try this one:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/jail", cmdtext, true) == 0) { if(GetPlayerColor(playerid) == 0x2641FEAA) { new Float:X, Float:Y, Float:Z; GetPlayerPos(playerid, X, Y, Z); for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { if(IsPlayerInRangeOfPoint(i, 3, X, Y, Z) && i != playerid && GetPlayerColor(i) == 0xFF8000FF) { SetPlayerPos(i, 263.7086,81.9716,1001.0391); SetPlayerInterior(i, 6); SetTimerEx("JailTimer", 180000, 0, "i", i); } } } } return 1; }
|
It works. Thankyu