Need some help? (Noob)
#1

Hello,im creating a dm script,and i wanna make a /leave command but i want to make it work ONLY when the player is in dm area,
Leave command:
Код:
  if(strcmp(cmdtext,"/leavedm", true) == 1)
  {
   if(IsPlayerInArea(playerid,x,y,z); //<---yes i got coordinates. -I want to make the area so if the player is in this area he can use the command to warp
	 return SetPlayerPos(playerid,x,y,z); //<----yes i got coordinates. -So he can teleport.

else if //-Wtf i wanted to try it,im a noob lol

return 0 GameTextForPlayer(playerid, "You are not in /dm!"); //So if he is not in the selected area he wont teleport.

}
Errors:
Код:
 error 004: function "IsPlayerInArea" is not implemented
error 001: expected token: ")", but found ";"
error 036: empty statement
fatal error 107: too many error messages on one line
Any help will be appreciated.Thanks!!!!!!
Reply
#2

if isplayerinarea part shouldnt have a ' ; ' at the end

so change if(IsPlayerInArea(playerid,x,y,z);

in if(IsPlayerInArea(playerid,x,y,z))

then post the errors you get after the change
Reply
#3

pawn Код:
//Ontop of your script
new IsInDM[MAX_PLAYERS];

//Under OnPlayerConnect and OnPlayerDisconnect
IsInDM[playerid] = 0;

//Under your command that puts you in your DM
IsInDM[playerid] = 1;

//And your command
if(strcmp(cmdtext,"/leavedm", true) == 1)
{
if(IsInDM[playerid] ==1)
{
SetPlayerPos(playerid,x,y,z); // Teleport location
IsInDM[playerid] = 0;
return 1;
}
GameTextForPlayer(playerid, "You are not in /dm!");
}
This makes a varible for every player and makes it 0 (false) when the player connects/disconnects.
When you teleport to the DM, the varible is 1. (true)
When you teleport out of the DM, the varible is 0. (false)

There's better was in doing this, but I see you're not an advanced scripter, so It's probably not a good idea to get you into the multidimensional arrays yet.
Reply
#4

Wouldn't this be much simpler? :
pawn Код:
new Indm[MAX_PLAYERS];
pawn Код:
if(strcmp(cmdtext,"/dm", true) == 1)
  {
   //Stuff you have for the dm (E.X setplayerpos,giveplayerweapon etc..)
   Indm[playerid] = 1;
   return 1;
  }
pawn Код:
if(strcmp(cmdtext,"/leavedm", true) == 1)
  {
    if(Indm[playerid] = 0)
    {
     SendClientMessage(playerid,COLOR,"You are not inside a DM.");
    }
    else
    {
     Indm[playerid] = 0;
     SendClientMessage(playerid,COLOR,"You have left the DM zone.");
    }
  return 1;
 }
EDIT: Damn, Joe_ beat me :/
Reply
#5

Wahahaha, pwnt!!1010100101

Reply
#6

LOL XD is helping people becoming a game of 'Who is the fast&best to help now?'

....Nice ...
Reply
#7

Thank you all,ill try your scripts now,thankssssss!!!!!!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)