deathmatch question
#1

Hi all,

I just wonder if its possible that people can't leave a deathmatch area till they die.
or/and
That people cant use commands anymore, but only the /back command to go back to las venturas.


code for going to a dm :

Код:
    case 0:
    {
		new rand = random(sizeof(DMSniperSpawns));
		new Playername[30], str[256];
		GetPlayerName(playerid, Playername, 30);
		GetPlayerPos(playerid, PosX[playerid], PosY[playerid], PosZ[playerid]);
		GetPlayerFacingAngle(playerid, PosA[playerid]);
        PosI[playerid] = (GetPlayerInterior(playerid));
		format(str, 256, "*** %s has teleported to deathmatch 1 (Sniper).", Playername);
		SendClientMessageToAll(COLOR_RED, str);
		SetPlayerPos(playerid, DMSniperSpawns[rand][0], DMSniperSpawns[rand][1], DMSniperSpawns[rand][2]); // Warp the player
		GetPlayerName(playerid, var0, 25);
		SetPlayerFacingAngle(playerid, 270.0);
		ResetPlayerWeapons(playerid);
		GivePlayerWeapon(playerid, 34, 25);
		SetPlayerHealth(playerid, 0.0);
		SetPlayerHealth(playerid, 100.0);
		SetPlayerInterior(playerid, 0);
		SetPlayerColor(playerid,COLOR_BLANK);
		TogglePlayerControllable(playerid,1);
Code for go to /back

Код:
		if(strcmp(cmdtext, "/back", true) == 0)
    {
    	SetPlayerPos(playerid, PosX[playerid], PosY[playerid], PosZ[playerid]);
    	SetPlayerFacingAngle(playerid, PosA[playerid]);
    	SetCameraBehindPlayer(playerid);
    	SetPlayerInterior(playerid, PosI[playerid]);
			return 1;
 		}
Reply
#2

put at the beginning script this:
pawn Код:
BlockCmd[MAX_PLAYERIS];
Put after case 0:{ this
pawn Код:
BlockCmd[playerid]=1;
And at /back:
pawn Код:
BlockCmd[playerid]=0;
ResetPlayerWeapon(playerid);
At OnPlayerDeath:
pawn Код:
BlockCmd[playerid]=0;
And at OnPlayerCommandText:
pawn Код:
if(BlockCmd[playerid] && strcmp(cmdtext, "/back", true) != 0)return SendClientMessage(playerid,0xFF0000AA, "[ERROR] You can not leave this dm! Uses: /back");
Reply
#3

ty i will try this



Thanks this work


1 little question more, why this doesnt work?

under the command /back i places this :

Код:
     if(gTeam[playerid] == TEAM_LIFEGUARDS)      { GivePlayerWeapon(playerid, 4, 1); }
     else if(gTeam[playerid] == TEAM_GOLFERS)  { GivePlayerWeapon(playerid, 2, 1); }
	   else if(gTeam[playerid] == TEAM_FBI)  { GivePlayerWeapon(playerid, 3, 1); }
	   else if(gTeam[playerid] == TEAM_TRIADS)  { GivePlayerWeapon(playerid,15, 1); }
	   else if(gTeam[playerid] == TEAM_COPS)   { GivePlayerWeapon(playerid, 3, 1); }
     else if(gTeam[playerid] == TEAM_MOBSTERS) { GivePlayerWeapon(playerid, 9, 1); }
	   else if(gTeam[playerid] == TEAM_GROVESTREET)  { GivePlayerWeapon(playerid, 6, 1); }
     else if(gTeam[playerid] == TEAM_VAGOS) { GivePlayerWeapon(playerid, 5, 1); }
and this
Код:
 if(gTeam[playerid] == TEAM_LIFEGUARDS)      { SetPlayerColor( playerid, LIFEGUARDS_COLOR);   }
 else if(gTeam[playerid] == TEAM_GOLFERS)  { SetPlayerColor( playerid, GOLFERS_COLOR); }
 else if(gTeam[playerid] == TEAM_FBI)  { SetPlayerColor( playerid, FBI_COLOR);  }
 else if(gTeam[playerid] == TEAM_TRIADS)  { SetPlayerColor( playerid, TRIADS_COLOR);  }
 else if(gTeam[playerid] == TEAM_COPS)   { SetPlayerColor( playerid, COPS_COLOR);   }
 else if(gTeam[playerid] == TEAM_MOBSTERS) { SetPlayerColor( playerid, MOBSTERS_COLOR); }
 else if(gTeam[playerid] == TEAM_GROVESTREET)  { SetPlayerColor( playerid, GROVESTREET_COLOR); }
 else if(gTeam[playerid] == TEAM_VAGOS) { SetPlayerColor( playerid, VAGOS_COLOR);}
But for some reason its only change the color/weapon back to the first team
Reply
#4

is it possible to make something like this?

Код:
SendClientMessage(playerid,0xFF0000AA, "[ERROR] You cant use /back because you're not in a dm area");

Reply
#5

yes dude:

pawn Код:
if(strcmp(cmdtext, "/back", true) == 0)
{
if(BlockCmd[playerid] ==1)
{
SetPlayerPos(playerid, PosX[playerid], PosY[playerid], PosZ[playerid]);
SetPlayerFacingAngle(playerid, PosA[playerid]);
SetCameraBehindPlayer(playerid);
SetPlayerInterior(playerid, PosI[playerid]);
ResetPlayerWeapon(playerid);
BlockCmd[playerid] =0;
}else SendClientMessage(playerid,0xFF0000AA, "[ERROR] You cant use /back because you're not in a dm area");
return 1;
}
Reply
#6

mmm i dont get this: in this function there a lot of errors , so i change all { to } (works now)


but the problem is now, if im in las venturas i cant use another commands anymore
Reply
#7

1.I fixed the mistakes :
pawn Код:
if(strcmp(cmdtext, "/back", true) == 0)
{
if(BlockCmd[playerid] ==1)
{
SetPlayerPos(playerid, PosX[playerid], PosY[playerid], PosZ[playerid]);
SetPlayerFacingAngle(playerid, PosA[playerid]);
SetCameraBehindPlayer(playerid);
SetPlayerInterior(playerid, PosI[playerid]);
ResetPlayerWeapon(playerid);
BlockCmd[playerid] =0;
}else SendClientMessage(playerid,0xFF0000AA, "[ERROR] You cant use /back because you're not in a dm area");
return 1;
}
2.Put at OnPlayerCommandText:
pawn Код:
if(IsPlayerInArea(playerid,-957.5858, 607.2495, 2942.825, 2942.825) //LV zone
{
SendClientMessage(playerid,0xFF0000AA,"[ERROR]You are in VasVentura");
return 0;
}
If you haven't function IsPlayerInArea:
pawn Код:
stock IsPlayerInArea(playerid, Float:max_x, Float:min_x, Float:max_y, Float:min_y)
{
    new Float:X, Float:Y, Float:Z;
    GetPlayerPos(playerid, X, Y, Z);
    if(X <= max_x && X >= min_x && Y <= max_y && Y >= min_y) return 1;
    return 0;
}
Reply
#8

This code gives a error :

Код:
		if(strcmp(cmdtext, "/back", true) == 0)
    {
    	if(BlockCmd[playerid] ==1)
		 }
    	SetPlayerPos(playerid, PosX[playerid], PosY[playerid], PosZ[playerid]);
    	SetPlayerFacingAngle(playerid, PosA[playerid]);
    	SetCameraBehindPlayer(playerid);
    	SetPlayerInterior(playerid, PosI[playerid]);
    	BlockCmd[playerid]=0;
  			ResetPlayerWeapons(playerid);
  			}else SendClientMessage(playerid,0xFF0000AA, "[ERROR] You cant use /back because you're not in a dm area");
		return 1;
 		}
Код:
C:\Program Files\Rockstar Games\GTA San Andreas\filterscripts\tele.pwn(93) : error 029: invalid expression, assumed zero
( Its the } under blockcmd , if i change it to { i get more errors then before)

p.s.: If i remove this } then the code is completly error free, but it have the same function as before.

Example:
1. from the deathmatch i typed : /back --> this function works
2. back in venturas: i cant typ another commands anymore then will this command show up :
[ERROR] You cant use /back because you're not in a dm area.
3. if i walk like 3 steps in las venturas and typ /back then i will putted back to the position where i last standed


(is playerinarea have no function for some reason?)
Reply
#9

pls someone?

Reply
#10

Please..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)