A few questions?
#1

1. How do I make it so if a player types "/reclass", it sends them into the player class selection?

2. How do I make it so if a play kills another player and the other play is the same skin, it makes the killers score -1
and if it's {
else
}
It makes your score go up 1+ point?

3. How would I make it so if a player has - 10,000 dollars, the player is kicked, it sends a message saying you have been kicked due to debt, and it sends
a message to the other players saying that person was kicked due to being in debt.

4. Anyone know the scripting code to add a /pm command into your server?

Thanks for your feedback in advance
Reply
#2

Quote:
Originally Posted by DeltaAirlines12
1. How do I make it so if a player types "/reclass", it sends them into the player class selection?
Here you go:

pawn Код:
if(strcmp("/reclass", cmdtext, true, 7) == 0)
{
  ForceClassSelection(playerid); // Sends them to the player class selection.
  SetPlayerHealth(playerid,0);
  return 1;
}
Quote:
Originally Posted by DeltaAirlines12
2. How do I make it so if a play kills another player and the other play is the same skin, it makes the killers score -1
Here you go:

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
  if(GetPlayerSkin(killerid) == GetPlayerSkin(playerid))
  {
     SetPlayerScore(killerid,GetPlayerScore(killerid) - 1) // Makes the killer's score - 1.
  }
  else
  {
    SetPlayerScore(killerid,GetPlayerScore(killerid) + 1) // Makes the killer's score + 1.
  }
  return 1;
}
Quote:
Originally Posted by DeltaAirlines12
3. How would I make it so if a player has - 10,000 dollars, the player is kicked, it sends a message saying you have been kicked due to debt, and it sends a message to the other players saying that person was kicked due to being in debt.
Here you go:

pawn Код:
SetTimer("MoneyCheck", 5000, 1); // Put this under OnGameModeInit callback.

public MoneyCheck() // Put this at the bottom of your script.
{
  for(new i = 0; i < 1000; i++)
  {
     if(GetPlayerMoney(i) <= -10000)
     {
       new playername[MAX_PLAYER_NAME], string[48];
       GetPlayerName(i, playername, sizeof(playername));
       format(string, sizeof(string), "SERVER: %s has kicked due to being in debt.", playername);
       SendClientMessageToAll(0xFFFF00AA, string);
       Kick(i);
     }
   }
   return 1;
}
Quote:
Originally Posted by DeltaAirlines12
4. Anyone know the scripting code to add a /pm command into your server?
Look in the base.pwn filterscript.
Reply
#3

For these, you'll need the foreach and zcmd include + sscanf.


Quote:

1. How do I make it so if a player types "/reclass", it sends them into the player class selection?

Код:
cmd(reclass, playerid, params[])
{
	ForceClassSelection(playerid);
	SetPlayerHealth(playerid, 0);
	return 1;
}
Quote:

2. How do I make it so if a play kills another player and the other play is the same skin, it makes the killers score -1
and if it's {
else
}
It makes your score go up 1+ point?

Код:
new PlayerScore[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
	PlayerScore[playerid] = 0;
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	if(GetPlayerSkin(playerid) == GetPlayerSkin(killerid))
	{
	  PlayerScore[killerid]--;
	}
	else
	{
	  PlayerScore[killerid]++;
	}
	return 1;
}
Quote:

3. How would I make it so if a player has - 10,000 dollars, the player is kicked, it sends a message saying you have been kicked due to debt, and it sends
a message to the other players saying that person was kicked due to being in debt.

Код:
new kicktimer;

public OnGameModeInit()
{
	kicktimer = SetTimer("KickForDebt", 5000, 1);
	return 1;
}

public OnGameModeExit()
{
	KillTimer(kicktimer);
	return 1;
}

public KickForDebt()
{
	foreach(Player, x)
	{
	  if(GetPlayerMoney(x) <= -10000)
	  {
	    SendClientMessage(x, 0xFF000000, "You have been kicked for being in excessive debt.");
	    Kick(x);
	  }
	}
	return;
}
Quote:

4. Anyone know the scripting code to add a /pm command into your server?

Код:
cmd(pm, playerid, params[])
{
	new sentto, message[128];
	if(sscanf(params, "us", sentto, message)) return SendClientMessage(playerid,0xFF0000FF,"USAGE: /PM (id) (message)");
	if(!IsPlayerConnected(id)) return SendClientMessage(playerid,0xFF000000,"Invalid ID");
	new string[128], sender[MAX_PLAYER_NAME], target[MAX_PLAYER_NAME];
	GetPlayerName(playerid, sender, sizeof sender);
	GetPlayerName(sentto, target, sizeof target);
	format(string, sizeof(string),"You tell %s(%i): %s", target, sentto, message);
	SendClientMessage(playerid, 0x4EEE9400, string);
	format(string, sizeof(string), "%s(%i) says: %s", sender, playerid, message);
	SendClientMessage(id, 0x4EEE9400, string);
	PlayerPlaySound(id,1085,0.0,0.0,0.0);
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)