SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts

Reply
 
Thread Tools Display Modes
Old 13/04/2007, 09:31 AM   #41
Sacky
Big Clucker
 
Join Date: Aug 2006
Posts: 78
Reputation: 0
Default Re: Useful Snippets

Automatic 1337 speak:

Global Declarations:

pawn Code:
new bool:leet[MAX_PLAYERS];

OnPlayerConnect:

pawn Code:
public OnPlayerConnect(playerid){
    leet[playerid] = false;
}

OnPlayerText:

pawn Code:
public OnPlayerText(playerid,text[]){
    if(leet[playerid]) format(text,MAX_STRING,"%s",StrToHacker(text));
    return 1;
}

OnPlayerCommandText:

pawn Code:
public OnPlayerCommandText(playerid,cmdtext[]){
    dcmd(leet,4,cmdtext);
    return 0;
}

DCMD leet command:

pawn Code:
dcmd_leet(playerid,params[]){
    if(!strlen(params)){
        SendClientMessage(playerid,COLOR_WHITE,"USAGE: /leet [on/off]");
        return 1;
    }
    if(strcmp(params,"on",true) == 0){
        SendClientMessage(playerid,COLOR_RED,"13375P34K Turned On");
        leet[playerid] = true;
        return 1;
    }
    if(strcmp(params,"off",true) == 0){
        SendClientMessage(playerid,COLOR_RED,"13375P34K Turned Off");
        leet[playerid] = false;
        return 1;
    }
    SendClientMessage(playerid,COLOR_WHITE,"USAGE: /leet [on/off]");
    return 1;
}

Requires:

StrToHacker

Can be found in the Useful Functions thread

Credit to Ramjet for the idea
Sacky is offline   Reply With Quote
Old 15/04/2007, 01:29 PM   #42
Maxx
Little Clucker
 
Join Date: Apr 2006
Posts: 16
Reputation: 0
Default Re: Useful Snippets

mhm. I Tested it. it works very well... :P
Maxx is offline   Reply With Quote
Old 15/04/2007, 01:51 PM   #43
yom
High-roller
 
Join Date: Jul 2006
Posts: 2,002
Reputation: 6
Default Re: Useful Snippets

Sacky you don't need strtok for this command, compare params
yom is offline   Reply With Quote
Old 15/04/2007, 01:57 PM   #44
Sacky
Big Clucker
 
Join Date: Aug 2006
Posts: 78
Reputation: 0
Default Re: Useful Snippets

Corrected, thanks for noticing
Sacky is offline   Reply With Quote
Old 18/04/2007, 02:12 AM   #45
Pixels^
Gangsta
 
Join Date: Dec 2006
Posts: 845
Reputation: 22
Default Re: Useful Snippets

A way to get a player's disconnect reason. May not be advanced, but it's useful.
pawn Code:
new kicked[MAX_PLAYERS];
pawn Code:
#define ban 2
#define kick 1
stock Kick2(playerid)
{
   kicked[playerid] = 1;
   return Kick(playerid);
}
pawn Code:
stock Ban2(playerid)
{
   kicked[playerid] = 2;
   return Ban(playerid);
}

A simple way to test it.
pawn Code:
public OnPlayerDisconnect(playerid)
{
   if(kicked[playerid] == ban)
   {
     //your code
   }
   if(kicked[playerid] == kick)
   {
     //your code
   }
   return 1;
}

OnPlayerScoreChange and OnPlayerGetMoney
Found in my xLog script, but just thought I should post it here.
pawn Code:
SetTimer("CheckMoney",1000,1);
SetTimer("CheckScore",1000,1);
pawn Code:
public CheckMoney()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
      if(M[i] < GetPlayerMoney(i))
      {
        OnPlayerGetMoney(i,GetPlayerMoney(i),M[i]);
      }
      M[i] = GetPlayerMoney(i);
    }
}
pawn Code:
public CheckScore()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
      if(S[i] < GetPlayerScore(i))
      {
        OnPlayerScoreChange(i,GetPlayerScore(i),S[i]);
      }
      S[i] = GetPlayerScore(i);
    }
}
pawn Code:
public OnPlayerGetMoney(playerid,newmoney,oldmoney)
{
    //Do whatever you want when a player gets or loses money
    return 1;
}

public OnPlayerScoreChange(playerid,newscore,oldscore)
{
    //Do whatever you want when a player changes score
    return 1;
}
Pixels^ is offline   Reply With Quote
Old 07/05/2007, 11:37 AM   #46
[xA]Ramjet
Big Clucker
 
Join Date: Jan 2007
Posts: 55
Reputation: 0
Default Re: Useful Snippets

1337 Money Grabber.

Description:
This snippet will get a player's money, and if it equals 1337, it will kill the player and decrease their confidence.

Place this under your OnGameModeInit() Callback.
pawn Code:
SetTimer("1337_MoneyCheck", 1000, true);

Now for the Timer :
pawn Code:
public 1337_MoneyCheck()
{
   for(new i; i < MAX_PLAYERS; i++)
   {
     if(IsPlayerConnected(i))
     {
        new cash = GetPlayerMoney(i);
        if(cash == 1337)
        {
           SetPlayerHealth(i, 0.0); // Kills the player.
           SendClientMessage(i, 0x10F441AA, "Not so elite now! xD.");
           ResetPlayerMoney(i); // Sets the player's money back to 0.
        }
     }
   }
}

This script will diminish the quality of your server. I only made it because I was bored and had nothing better to do.

Cheers,
Ramjet.
[xA]Ramjet is offline   Reply With Quote
Old 08/05/2007, 12:47 AM   #47
Pixels^
Gangsta
 
Join Date: Dec 2006
Posts: 845
Reputation: 22
Default Re: Useful Snippets

I don't see anything useful about it. How about altering it so if the player's name has 1337 characters, then maybe do the resetcash and message?
Pixels^ is offline   Reply With Quote
Old 08/05/2007, 01:53 AM   #48
Allan
Little Clucker
 
Join Date: May 2006
Posts: 38
Reputation: 0
Default Re: Useful Snippets

Quote:
Originally Posted by Pixels^
I don't see anything useful about it. How about altering it so if the player's name has 1337 characters, then maybe do the resetcash and message?
Surely if it had that many characters in the name, it would get cut off way before it was 1337 in length :S
Allan is offline   Reply With Quote
Old 08/05/2007, 02:03 AM   #49
Redirect Left
High-roller
 
Redirect Left's Avatar
 
Join Date: Mar 2007
Location: Yorkshire, England
Posts: 1,302
Reputation: 362
Default Re: Useful Snippets

Well, I lol'd at the prospect, seems a bit silly though.

Redirect Left is offline   Reply With Quote
Old 08/05/2007, 07:13 AM   #50
[xA]Ramjet
Big Clucker
 
Join Date: Jan 2007
Posts: 55
Reputation: 0
Default Re: Useful Snippets

Quote:
Originally Posted by Pixels^
I don't see anything useful about it.
But it maybe to psychotic server owners. TBH I dont care if it is of no use to you, but there is people that may actually want something as lame as this in there scripts (these people have problems).

Quote:
Originally Posted by [RP
Jolteon ]
Well, I lol'd at the prospect, seems a bit silly though.
Damn straight .

Quote:
Originally Posted by Ramjet:SU
I only made it because I was bored and had nothing better to do.
I also felt that there needed to be more randoms snippets out there; there are ludicrous idiots that do want these retarded snippets, but don't have a clue what they are doing; not that making timers are hard; but thats the point.

Quote:
Originally Posted by Pixels^
How about altering it so if the player's name has 1337 characters, then maybe do the resetcash and message?
Does SA-MP have a SetPlayerName() native? No!

The only way this could be plausible is to make a 3rd party program for the samp-server.exe and edit the PlayerName address, and use playerid offsets (0xA80.

Cheers,
Ramjet.
[xA]Ramjet is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
READ Usefull Links to snippets and other -Sneaky- Help Archive 5 02/05/2009 12:22 PM


All times are GMT. The time now is 07:21 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.