Useful Snippets

Simple Admin Duty

__________________________________________________ __________________________________________________ _______________________________________________
pawn Код:
if(strcmp(cmdtext, "/aduty", true) == 0)
  {
  if (IsPlayerAdmin(playerid))
    {
  SetPlayerColor(playerid,COLOR_GREEN);
  SetPlayerHealth(playerid,99999999);
  SetPlayerArmour(playerid,99999999);
  SetPlayerSkin(playerid,217);
  GetPlayerName(playerid, pName, sizeof(pName));
    format(string, sizeof(string), "XST Admin %s is on Admin Duty please fell free to contact him (/PM) or report rules breakers (/REPORT ID REASON)", pName);
    SendClientMessageToAll(COLOR_RED, string);
  }
  else
  {
  SendClientMessage(playerid, COLOR_GREY, "You are not RCON Admin");
  }
    return 1;
  }
  if(strcmp(cmdtext, "/adutyoff", true) == 0)
  {
  if (IsPlayerAdmin(playerid))
    {
  SetPlayerColor(playerid,COLOR_RED);
  SetPlayerHealth(playerid,100);
  SetPlayerWantedLevel(playerid,0);
  SetPlayerSkin(playerid,0);
  SetPlayerArmour(playerid,0);
  GetPlayerName(playerid, pName, sizeof(pName));
    format(string, sizeof(string), "XST Admin %s Is off Admin Duty", pName);
    SendClientMessageToAll(COLOR_YELLOW, string);
  }
  else
  {
  SendClientMessage(playerid, COLOR_GREY, "You are not RCON Admin");
  }
    return 1;
  }
__________________________________________________ __________________________________________________ _______________________________________________

Reply

Changing Interiors In-Game simply for GF and LA-RP

Houses!
pawn Код:
if(strcmp(cmd, "/ahouseint", true) == 0)
    {
      if(IsPlayerConnected(playerid))
      {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_WHITE, "USAGE: /ahouseint [houseid] [id (1-42)]");
                return 1;
            }
            if (PlayerInfo[playerid][pAdmin] >= 1337)
            {
                    new id;
                    id = strval(tmp);
                    if(id > sizeof(HouseInfo)) return SendClientMessage(playerid, COLOR_GREY, "  Wrong house id");
                    tmp = strtok(cmdtext, idx);
                    if(!strlen(tmp))
                    {
                        SendClientMessage(playerid, COLOR_WHITE, "[USAGE:] /ahouseint [houseid] [id (1-42)]");
                        return 1;
                    }
                    new id2;
                    id2 = strval(tmp);
                    if(id2 < 1 || id2 > 42) { SendClientMessage(playerid, COLOR_WHITE, "[ERROR:] Interior ID's 1-42."); return 1; }
                    if(id2 == 1)
                    {
                        HouseInfo[id][hExitx] = 235.3054;
                        HouseInfo[id][hExity] = 1186.6835;
                        HouseInfo[id][hExitz] = 1080.2578;
                        HouseInfo[id][hInt] = 3;
                        format(string, sizeof string, "House ID: %d - Description: Large/2 story/3 bedrooms/clone of House 9.", id,id2);
                        SendClientMessage(playerid, COLOR_WHITE,string);
                }
                else if(id2 == 2)
                    {
                        HouseInfo[id][hExitx] = 225.756989;
                        HouseInfo[id][hExity] = 1240.000000;
                        HouseInfo[id][hExitz] = 1082.149902;
                        HouseInfo[id][hInt] = 2;
                        format(string, sizeof string, "House ID: %d - Description: Medium/1 story/1 bedroom.", id);
                        SendClientMessage(playerid, COLOR_WHITE,string);
                }
                    else if(id2 == 3)
                    {
                        HouseInfo[id][hExitx] = 223.1929;
                        HouseInfo[id][hExity] = 1287.0780;
                        HouseInfo[id][hExitz] = 1082.1406;
                        HouseInfo[id][hInt] = 1;
                        format(string, sizeof string, "House ID: %d - Description: Small/1 story/1 bedroom.", id);
                        SendClientMessage(playerid, COLOR_WHITE,string);
                }
                else if(id2 == 4)
                    {
                        HouseInfo[id][hExitx] = 225.630997; HouseInfo[id][hExity] = 1022.479980; HouseInfo[id][hExitz] = 1084.069946;
                        HouseInfo[id][hInt] = 7;
                        format(string, sizeof string, "House ID: %d - Description: VERY Large/2 story/4 bedrooms.", id);
                        SendClientMessage(playerid, COLOR_WHITE,string);
                }
                else if(id2 == 5)
                    {
                        HouseInfo[id][hExitx] = 295.138977; HouseInfo[id][hExity] = 1474.469971; HouseInfo[id][hExitz] = 1080.519897;
                        HouseInfo[id][hInt] = 15;
                        format(string, sizeof string, "House ID: %d - Description: Small/1 story/2 bedrooms.", id);
                        SendClientMessage(playerid, COLOR_WHITE,string);
                }
                else if(id2 == 6)
                    {
                        HouseInfo[id][hExitx] = 328.1066; HouseInfo[id][hExity] = 1478.0106; HouseInfo[id][hExitz] = 1084.4375;
                        HouseInfo[id][hInt] = 15;
                        format(string, sizeof string, "House ID: %d - Description: Small/1 story/2 bedrooms.", id);
                        SendClientMessage(playerid, COLOR_WHITE,string);
                }
                else if(id2 == 7)
                    {
                        HouseInfo[id][hExitx] = 385.803986; HouseInfo[id][hExity] = 1471.769897; HouseInfo[id][hExitz] = 1080.209961;
                        HouseInfo[id][hInt] = 15;
                        format(string, sizeof string, "House ID: %d - Description: Small/1 story/1 bedroom/NO BATHROOM.", id);
                        SendClientMessage(playerid, COLOR_WHITE,string);
                }
                else if(id2 == 8)
                    {
                        HouseInfo[id][hExitx] = 375.971985; HouseInfo[id][hExity] = 1417.269897; HouseInfo[id][hExitz] = 1081.409912;
                        HouseInfo[id][hInt] = 15;
                        format(string, sizeof string, "House ID: %d - Description: Small/1 story/1 bedroom.", id);
                        SendClientMessage(playerid, COLOR_WHITE,string);
                }
                else if(id2 == 9)
                    {
                        HouseInfo[id][hExitx] = 490.810974; HouseInfo[id][hExity] = 1401.489990; HouseInfo[id][hExitz] = 1080.339966;
                        HouseInfo[id][hInt] = 2;
                        format(string, sizeof string, "House ID: %d - Description: Large/2 story/3 bedrooms.", id);
                        SendClientMessage(playerid, COLOR_WHITE,string);
                }
                else if(id2 == 10)
                    {
                        HouseInfo[id][hExitx] = 446.8264; HouseInfo[id][hExity] = 1397.3435; HouseInfo[id][hExitz] = 1084.3047;
                        HouseInfo[id][hInt] = 2;
                        format(string, sizeof string, "House ID: %d - Description: Medium/1 story/2 bedrooms.", id);
                        SendClientMessage(playerid, COLOR_WHITE,string);
                }
                else if(id2 == 11)
                    {
                        HouseInfo[id][hExitx] = 227.722992; HouseInfo[id][hExity] = 1114.389893; HouseInfo[id][hExitz] = 1081.189941;
                        HouseInfo[id][hInt] = 5;
                        format(string, sizeof string, "House ID: %d - Description: Large/2 story/4 bedrooms.", id);
                        SendClientMessage(playerid, COLOR_WHITE,string);
                }
                else if(id2 == 12)
                    {
                        HouseInfo[id][hExitx] = 260.983978; HouseInfo[id][hExity] = 1286.549927; HouseInfo[id][hExitz] = 1080.299927;
                        HouseInfo[id][hInt] = 4;
                        format(string, sizeof string, "House ID: %d - Description: Small/1 story/1 bedroom.", id);
                        SendClientMessage(playerid, COLOR_WHITE,string);
                }
                else if(id2 == 13)
                    {
                        HouseInfo[id][hExitx] = 221.7330; HouseInfo[id][hExity] = 1140.5146; HouseInfo[id][hExitz] = 1082.6094;
                        HouseInfo[id][hInt] = 4;
                        format(string, sizeof string, "House ID: %d - Description: Small/1 story/1 bedroom/NO BATHROOM!", id);
                        SendClientMessage(playerid, COLOR_WHITE,string);
                }
                else if(id2 == 14)
                    {
                        HouseInfo[id][hExitx] = 27.132700; HouseInfo[id][hExity] = 1341.149902; HouseInfo[id][hExitz] = 1084.449951;
                        HouseInfo[id][hInt] = 10;
                        format(string, sizeof string, "House ID: %d - Description: Medium/2 story/1 bedroom.", id);
                        SendClientMessage(playerid, COLOR_WHITE,string);
                }
                else if(id2 == 15)
                    {
                        HouseInfo[id][hExitx] = -262.601990; HouseInfo[id][hExity] = 1456.619995; HouseInfo[id][hExitz] = 1084.449951;
                        HouseInfo[id][hInt] = 4;
                        format(string, sizeof string, "House ID: %d - Description: Large/2 story/1 bedroom/NO BATHROOM!", id);
                        SendClientMessage(playerid, COLOR_WHITE,string);
                }
                else if(id2 == 16)
                    {
                        HouseInfo[id][hExitx] = 22.778299; HouseInfo[id][hExity] = 1404.959961; HouseInfo[id][hExitz] = 1084.449951;
                        HouseInfo[id][hInt] = 5;
                        format(string, sizeof string, "House ID: %d - Description: Medium/1 story/2 bedrooms/NO BATHROOM or DOORS!", id);
                        SendClientMessage(playerid, COLOR_WHITE,string);
                }
                else if(id2 == 17)
                    {
                        HouseInfo[id][hExitx] = 140.2267; HouseInfo[id][hExity] = 1365.9246; HouseInfo[id][hExitz] = 1083.8594;
                        HouseInfo[id][hInt] = 5;
                        format(string, sizeof string, "House ID: %d - Description: Large/2 story/4 bedrooms/NO BATHROOM!", id);
                        SendClientMessage(playerid, COLOR_WHITE,string);
                }
                else if(id2 == 18)
                    {
                        HouseInfo[id][hExitx] = 234.045990; HouseInfo[id][hExity] = 1064.879883; HouseInfo[id][hExitz] = 1084.309937;
                        HouseInfo[id][hInt] = 6;
                        format(string, sizeof string, "House ID: %d - Description: Large/2 story/3 bedrooms.", id);
                        SendClientMessage(playerid, COLOR_WHITE,string);
                }
                else if(id2 == 19)
                    {
                        HouseInfo[id][hExitx] = -68.294098; HouseInfo[id][hExity] = 1353.469971; HouseInfo[id][hExitz] = 1080.279907;
                        HouseInfo[id][hInt] = 6;
                        format(string, sizeof string, "House ID: %d - Description: Small/1 story/NO BEDROOM!", id);
                        SendClientMessage(playerid, COLOR_WHITE,string);
                }
                else if(id2 == 20)
                    {
                        HouseInfo[id][hExitx] = -285.548981; HouseInfo[id][hExity] = 1470.979980; HouseInfo[id][hExitz] = 1084.449951;
                        HouseInfo[id][hInt] = 15;
                        format(string, sizeof string, "House ID: %d - Description: 1 bedroom/living room/kitchen/NO BATHROOM", id);
                        SendClientMessage(playerid, COLOR_WHITE,string);
                }
                else if(id2 == 21)
                    {
                        HouseInfo[id][hExitx] = -42.581997; HouseInfo[id][hExity] = 1408.109985; HouseInfo[id][hExitz] = 1084.449951;
                        HouseInfo[id][hInt] = 8;
                        format(string, sizeof string, "House ID: %d - Description: Small/1 story/NO BEDROOM!", id);
                        SendClientMessage(playerid, COLOR_WHITE,string);
                }
                else if(id2 == 22)
                    {
                        HouseInfo[id][hExitx] = 83.345093; HouseInfo[id][hExity] = 1324.439941; HouseInfo[id][hExitz] = 1083.889893;
                        HouseInfo[id][hInt] = 9;
                        format(string, sizeof string, "House ID: %d - Description: Medium/2 story/2 bedrooms", id);
                        SendClientMessage(playerid, COLOR_WHITE,string);
                }
                else if(id2 == 23)
                    {
                        HouseInfo[id][hExitx] = 260.941986; HouseInfo[id][hExity] = 1238.509888; HouseInfo[id][hExitz] = 1084.259888;
                        HouseInfo[id][hInt] = 9;
                        format(string, sizeof string, "House ID: %d - Description: Small/1 story/1 bedroom", id);
                        SendClientMessage(playerid, COLOR_WHITE,string);
                }
                else if(id2 == 24)
                    {
                        HouseInfo[id][hExitx] = 244.411987; HouseInfo[id][hExity] = 305.032990; HouseInfo[id][hExitz] = 999.231995;
                        HouseInfo[id][hInt] = 1;
                        format(string, sizeof string, "House ID: %d - Description: Denise's Bedroom", id);
                        SendClientMessage(playerid, COLOR_WHITE,string);
                }
                else if(id2 == 25)
                    {
                        HouseInfo[id][hExitx] = 266.4991; HouseInfo[id][hExity] = 304.9922; HouseInfo[id][hExitz] = 999.1484;
                        HouseInfo[id][hInt] = 2;
                        format(string, sizeof string, "House ID: %d - Description: Katie's Bedroom", id);
                        SendClientMessage(playerid, COLOR_WHITE,string);
                }
                else if(id2 == 26)
                    {
                        HouseInfo[id][hExitx] = 291.282990; HouseInfo[id][hExity] = 310.031982; HouseInfo[id][hExitz] = 999.154968;
                        HouseInfo[id][hInt] = 3;
                        format(string, sizeof string, "House ID: %d - Description: Helena's Bedroom (barn) - limited movement.", id);
                        SendClientMessage(playerid, COLOR_WHITE,string);
                }
                else if(id2 == 27)
                    {
                        HouseInfo[id][hExitx] = 302.181000; HouseInfo[id][hExity] = 300.722992; HouseInfo[id][hExitz] = 999.231995;
                        HouseInfo[id][hInt] = 4;
                        format(string, sizeof string, "House ID: %d - Description: Michelle's Bedroom.", id);
                        SendClientMessage(playerid, COLOR_WHITE,string);
                }
                else if(id2 == 28)
                    {
                        HouseInfo[id][hExitx] = 322.197998; HouseInfo[id][hExity] = 302.497986; HouseInfo[id][hExitz] = 999.231995;
                        HouseInfo[id][hInt] = 5;
                        format(string, sizeof string, "House ID: %d - Description: Barbara's Bedroom.", id);
                        SendClientMessage(playerid, COLOR_WHITE,string);
                }
                else if(id2 == 29)
                    {
                        HouseInfo[id][hExitx] = 346.870025; HouseInfo[id][hExity] = 309.259033; HouseInfo[id][hExitz] = 999.155700;
                        HouseInfo[id][hInt] = 6;
                        format(string, sizeof string, "House ID: %d - Description: Millie's Bedroom.", id);
                        SendClientMessage(playerid, COLOR_WHITE,string);
                }
                else if(id2 == 30)
                    {
                        HouseInfo[id][hExitx] = 2495.6416; HouseInfo[id][hExity] = -1692.2361; HouseInfo[id][hExitz] = 1014.7422;
                        HouseInfo[id][hInt] = 3;
                        format(string, sizeof string, "House ID: %d - Description: CJ's Mom's House.", id);
                        SendClientMessage(playerid, COLOR_WHITE,string);
                }
                else if(id2 == 31)
                    {
                        HouseInfo[id][hExitx] = 1263.079956; HouseInfo[id][hExity] = -785.308960; HouseInfo[id][hExitz] = 1091.959961;
                        HouseInfo[id][hInt] = 5;
                        format(string, sizeof string, "House ID: %d - Description: Madd Dogg's Mansion (West door).", id);
                        SendClientMessage(playerid, COLOR_WHITE,string);
                }
                else if(id2 == 32)
                    {
                        HouseInfo[id][hExitx] = 2468.4502; HouseInfo[id][hExity] = -1698.4801; HouseInfo[id][hExitz] = 1013.5078;
                        HouseInfo[id][hInt] = 2;
                        format(string, sizeof string, "House ID: %d - Description: Ryder's house.", id);
                        SendClientMessage(playerid, COLOR_WHITE,string);
                }
                else if(id2 == 33)
                    {
                        HouseInfo[id][hExitx] = 2526.459961; HouseInfo[id][hExity] = -1679.089966; HouseInfo[id][hExitz] = 1015.500000;
                        HouseInfo[id][hInt] = 1;
                        format(string, sizeof string, "House ID: %d - Description: Sweet's House (South side of house is fucked).", id);
                        SendClientMessage(playerid, COLOR_WHITE,string);
                }
                else if(id2 == 34)
                    {
                        HouseInfo[id][hExitx] = 2543.659912; HouseInfo[id][hExity] = -1303.629883; HouseInfo[id][hExitz] = 1025.069946;
                        HouseInfo[id][hInt] = 2;
                        format(string, sizeof string, "House ID: %d - Description: Big Smoke's Crack Factory (Ground Floor).", id);
                        SendClientMessage(playerid, COLOR_WHITE,string);
                }
                else if(id2 == 35)
                    {
                        HouseInfo[id][hExitx] = 744.542969; HouseInfo[id][hExity] = 1437.669922; HouseInfo[id][hExitz] = 1102.739990;
                        HouseInfo[id][hInt] = 6;
                        format(string, sizeof string, "House ID: %d - Description: Fanny Batter's Whore House.", id);
                        SendClientMessage(playerid, COLOR_WHITE,string);
                }
                else if(id2 == 36)
                    {
                        HouseInfo[id][hExitx] = 964.106995; HouseInfo[id][hExity] = -53.205498; HouseInfo[id][hExitz] = 1001.179993;
                        HouseInfo[id][hInt] = 3;
                        format(string, sizeof string, "House ID: %d - Description: Tiger Skin Rug Brothel.", id);
                        SendClientMessage(playerid, COLOR_WHITE,string);
                }
                else if(id2 == 37)
                    {
                        HouseInfo[id][hExitx] = 2350.339844; HouseInfo[id][hExity] = -1181.649902; HouseInfo[id][hExitz] = 1028.000000;
                        HouseInfo[id][hInt] = 5;
                        format(string, sizeof string, "House ID: %d - Description: Burning Desire Gang House.", id);
                        SendClientMessage(playerid, COLOR_WHITE,string);
                }
                else if(id2 == 38)
                    {
                        HouseInfo[id][hExitx] = 2807.9172; HouseInfo[id][hExity] = -1174.4333; HouseInfo[id][hExitz] = 1025.5703;
                        HouseInfo[id][hInt] = 8;
                        format(string, sizeof string, "House ID: %d - Description: Colonel Furhberger's House.", id);
                        SendClientMessage(playerid, COLOR_WHITE,string);
                }
                else if(id2 == 39)
                    {
                        HouseInfo[id][hExitx] = 318.7010; HouseInfo[id][hExity] = 1114.7716; HouseInfo[id][hExitz] = 1083.8828;
                        HouseInfo[id][hInt] = 5;
                        format(string, sizeof string, "House ID: %d - Description: Crack Den.", id);
                        SendClientMessage(playerid, COLOR_WHITE,string);
                }
                else if(id2 == 40)
                    {
                        HouseInfo[id][hExitx] = 2324.3267; HouseInfo[id][hExity] = -1149.1440; HouseInfo[id][hExitz] = 1050.7101;
                        HouseInfo[id][hInt] = 12;
                        format(string, sizeof string, "House ID: %d - Description: Unused Safe House.", id);
                        SendClientMessage(playerid, COLOR_WHITE,string);
                }
                else if(id2 == 41)
                    {
                        HouseInfo[id][hExitx] = 446.5014; HouseInfo[id][hExity] = 507.0295; HouseInfo[id][hExitz] = 1001.4195;
                        HouseInfo[id][hInt] = 12;
                        format(string, sizeof string, "House ID: %d - Description: Budget Inn Motel Room.", id);
                        SendClientMessage(playerid, COLOR_WHITE,string);
                }
                else if(id2 == 42)
                    {
                        HouseInfo[id][hExitx] = 2216.3398; HouseInfo[id][hExity] = -1150.5099; HouseInfo[id][hExitz] = 1025.7969;
                        HouseInfo[id][hInt] = 15;
                        format(string, sizeof string, "House ID: %d - Description: Jefferson Motel. (REALLY EXPENSIVE)", id);
                        SendClientMessage(playerid, COLOR_WHITE,string);
                }
                    OnPropUpdate();
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "Your not an administrator.");
            }
        }
        return 1;
    }
Reply

Maybe this will help someone.

pawn Код:
forward ParachuteCheck();

public OnFilterScriptInit()
{
    SetTimer("ParachuteCheck",1000,1);
    return 1;
}

public ParachuteCheck()
{
    new Float:z;
    for(new i; i<MAX_PLAYERS; i++)
    {
        if(!IsPlayerInAnyVehicle(i))
        {
            GetPlayerVelocity(i,z,z,z);
           
            if(z < -0.7)
              GivePlayerWeapon(i,46,1);
        }
    }
}
Auto parachute.
Reply

Quote:
Originally Posted by Baked-Banana
Auto parachute.
wouldnt that give you each second you dont fall a parachute (z < -0.7) ? Just noticed how stupid I am Its minus ^^"
And the code doesnt check if the player is connected
Reply

Quote:
Originally Posted by ♣ Joker ♠
Quote:
Originally Posted by Baked-Banana
Auto parachute.
wouldnt that give you each second you dont fall a parachute (z < -0.7) ?
And the code doesnt check if the player is connected
IsPlayerInAnyVehicle internally checks if the player is connected, if I recall.
Reply

Quote:
Originally Posted by Calgon
Quote:
Originally Posted by ♣ Joker ♠
Quote:
Originally Posted by Baked-Banana
Auto parachute.
wouldnt that give you each second you dont fall a parachute (z < -0.7) ?
And the code doesnt check if the player is connected
IsPlayerInAnyVehicle internally checks if the player is connected, if I recall.
Yes, it checks if the player is connected and if not it returns 0
so if you check if IsPlayerInAnyVehicle(i) == 0 it would mean that it goes on if the player isnt connected
Reply

GetPlayerVelocity would set the values to 0.0 0.0 0.0
Reply

Jetpack detection

pawn Код:
public OnGameModeInit()
{
   SetTimer("JPD",7500,1);
   return 1;
}
forward JPD();
public JPD()
{
   for(new i; i < MAX_PLAYERS; i++)
   {
     if(IsPlayerConnected(i) && GetPlayerSpecialAction(i) == 2)
     {
        //Do your thing
     }
   }
   return 1;
}
Reply

Edit-Wrong topic . . . http://forum.sa-mp.com/index.php?top...751#msg1067751
Reply

Anti-script-theft:

pawn Код:
#define GM_IP "127.0.0.1" // IP to run on - Will run on any if "bind" not present in server.cfg
#define GM_PORT 7777 // Port to run on - Will ONLY run on this port
pawn Код:
stock epicFail() {
  print("Nope soz");
  SendRconCommand("exit");
  return 1;
}
pawn Код:
public OnGameModeInit() {
  new serverip[20];
  GetServerVarAsString("bind",serverip,20);
  if((serverip[0] != '\0') && (strcmp(serverip,GM_IP))) {
    return epicFail();
  }
  new port = GetServerVarAsInt("port");
  if(port != GM_PORT) {
    return epicFail();
  }
  return 1;
}
Reply

Now you will have script kiddies/trolls adding this to their scripts for the "LULZ", sure the offending gamemode can be removed from the forums but not instantly and it will greatly affect people who downloaded it before removal.. some innocent guy may just want to run the advertised gamemode. Not everyone who runs a server can read source code and you can't expect them to either. By posting this you improve the chances that a malicious script would be released. I'd suggest you remove your snippet, if someone has a source that's worth protecting then they'll be able to code something like this themselves.
Reply

Quote:
Originally Posted by Simon
Now you will have script kiddies/trolls adding this to their scripts for the "LULZ", sure the offending gamemode can be removed from the forums but not instantly and it will greatly affect people who downloaded it before removal.. some innocent guy may just want to run the advertised gamemode. Not everyone who runs a server can read source code and you can't expect them to either. By posting this you improve the chances that a malicious script would be released. I'd suggest you remove your snippet, if someone has a source that's worth protecting then they'll be able to code something like this themselves.
Then the script kiddies and trolls can be banned.
I understand what you mean, though, and changed my code. It'd be pretty obvious if somebody did add it to a released script, but still destructive. Thanks for the comment.
Reply

Uh how would that anti script theft work... Is it only for an amx file?
Reply

Quote:
Originally Posted by ♂ Antonio [G-RP
]
Uh how would that anti script theft work... Is it only for an amx file?
Yes, amx only, because someone could just remove it from the source.

ev0lutionnn: Script kiddies & trolls can also evade a ban easily too, they don't care if they're banned. Thanks for removing the malicious part
Reply

Quote:
Originally Posted by ♂ Antonio [G-RP
]
Uh how would that anti script theft work... Is it only for an amx file?
Yeah, as Simon said it's only for compiled scripts.
There's no way to protect the source code unless you encrypt it or something like that. Or just don't give it out to idiots.
Reply

Quote:
Originally Posted by yom
View Post
Delvour\'s pawn version :

pawn Code:
public OnGameModeInit()
{
  SetTimer("SendBotMessage",500,1);
  return 1;
}

new BOT_NAME[] = "Delvour";
new ANSWERS_A[][] = {"Yes.","No.","Maybe.","Fuck you!","Who knows...","I don\'t know.","Whatever.."};
new ANSWERS_B[][] = {"That\'s not a question.","You don\'t ask me anything.","I answer to questions."};
new ANSWERS_C[][] = {"I\'m busy atm.","Yes?","What?","Zzzz..","Leave me alone!","Do not annoy me."};
new WaitAnswer;
new botmsg[256];

public OnPlayerText(playerid, text[])
{
  new idx = 0;
  botmsg = strsep(text,idx);

  if (!strcmp(botmsg,BOT_NAME,true) && !WaitAnswer)
  {
    botmsg = strsep(text,idx);
    if (text[strlen(text)-1] == \'?\' && strlen(text) > strlen(BOT_NAME)+4)
    {
      format(botmsg,sizeof(botmsg),"%s",ANSWERS_A[random(sizeof(ANSWERS_A))]);
    }
    else if (text[strlen(text)-1] != \'?\' && strlen(text) > strlen(BOT_NAME))
    {
      format(botmsg,sizeof(botmsg),"%s",ANSWERS_B[random(sizeof(ANSWERS_B))]);
    }
    else
    {
      format(botmsg,sizeof(botmsg),"%s",ANSWERS_C[random(sizeof(ANSWERS_C))]);
    }
    format(botmsg,sizeof(botmsg),"%s: %s",BOT_NAME,botmsg);
    WaitAnswer = 1;
    return 1;
  }
  return 1;
}

public SendBotMessage()
{
  if (WaitAnswer)
  {
    SendClientMessageToAll(0xFF0000AA,botmsg);
    WaitAnswer = 0;
  }
}


The timer is needed, else it send the message before what you type in the chat


You need \'strsep\' and you can find it HERE


Have fun...


ok y_less, corrected.
Is there a way to make this work with strtok??
Reply

Just Something Simple. Changing Game Mode Texts.
At The Top
pawn Код:
forward changegmtext1();
forward changegmtext2();
forward changegmtext3();
forward changegmtext4();
new timer2;
new timer3;
new timer4;
new timer1;
Under OnGameModeInit
pawn Код:
SetGameModeText("Starting GM Text Here");
    timer1 = SetTimer("changegmtext1",1000,false);
Anywhere underneath OnGameModeInit
pawn Код:
public changegmtext1()
{
    SetGameModeText("GM Text 1");
    KillTimer(timer1);
    timer2 = SetTimer("changegmtext2",1000,false);
}
public changegmtext2()
{
    SetGameModeText("GM Text 2");
    KillTimer(timer2);
    timer3 = SetTimer("changegmtext3",1000,false);
}
public changegmtext3()
{
    SetGameModeText("GM Text 3");
    KillTimer(timer3);
    timer4 = SetTimer("changegmtext4",1000,false);
}
public changegmtext4()
{
    SetGameModeText("GM Text 4");
    KillTimer(timer4);
    SetTimer("changegmtext1",1000,false);
}
My First Release on here
Reply

Quote:
Originally Posted by Floul1
Посмотреть сообщение
Just Something Simple. Changing Game Mode Texts.
At The Top
pawn Код:
forward changegmtext1();
forward changegmtext2();
forward changegmtext3();
forward changegmtext4();
new timer2;
new timer3;
new timer4;
new timer1;
Under OnGameModeInit
pawn Код:
SetGameModeText("Starting GM Text Here");
    timer1 = SetTimer("changegmtext1",1000,false);
Anywhere underneath OnGameModeInit
pawn Код:
public changegmtext1()
{
    SetGameModeText("GM Text 1");
    KillTimer(timer1);
    timer2 = SetTimer("changegmtext2",1000,false);
}
public changegmtext2()
{
    SetGameModeText("GM Text 2");
    KillTimer(timer2);
    timer3 = SetTimer("changegmtext3",1000,false);
}
public changegmtext3()
{
    SetGameModeText("GM Text 3");
    KillTimer(timer3);
    timer4 = SetTimer("changegmtext4",1000,false);
}
public changegmtext4()
{
    SetGameModeText("GM Text 4");
    KillTimer(timer4);
    SetTimer("changegmtext1",1000,false);
}
My First Release on here
shit!

see!

pawn Код:
stock ChangeGameMode;
Under OnGameModeInit
pawn Код:
SetGameModeText("Starting GM Text Here");
    SetTimer("changegmtext",1000,false);
Anywhere underneath OnGameModeInit
pawn Код:
forward changegmtext();
public changegmtext()
{
    switch (ChangeGameMode)
    {
             case 0: SetGameModeText("TEXT ONE");
             case 1: SetGameModeText("TEXT TWO");
             case 2: SetGameModeText("TEXT THREE");
    }
    if (ChangeGameMode == 3) ChangeGameMode = 0;
    else ChangeGameMode++;
        return 1;
}
by Johnny aka Johnny_Xayc
Reply

Quote:
Originally Posted by Johnny_Xayc
Посмотреть сообщение
pawn Код:
SetTimer("changegmtext",1000,false);
Fail... there should be true not false
Reply

Lock the players vehicle for everyone but the player.

pawn Код:
//My version
if (IsPlayerInAnyVehicle(playerid) == 1)
{
        for(new i; i < MAX_PLAYERS; i++)
    {
        SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid), i, 0, 1);
        SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid), playerid, 0, 0);
    }
    return 1;
}
- or move the players vehicle parameters, out of the loop, and assign GetPlayerVehicleID elsewhere (call only once)

pawn Код:
//Suggested by Nero_3D
if (IsPlayerInAnyVehicle(playerid) == 1)
{
        new gVehicle[MAX_PLAYERS];
        gVehicle[playerid] = GetPlayerVehicleID(playerid);
        for(new i; i < MAX_PLAYERS; i++)
    {
        SetVehicleParamsForPlayer(gVehicle, i, 0, 1);
    }
        SetVehicleParamsForPlayer(gVehicle, playerid, 0, 0);
    return 1;
}
There is another function for this, in a way. But i find the above more efficient
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)