Las Venturas Playground
Useful Functions/Snippets/Commands - Printable Version

+- Las Venturas Playground (https://forum.sa-mp.nl)
+-- Forum: Miscellaneous (https://forum.sa-mp.nl/forum-4.html)
+--- Forum: Gaming (https://forum.sa-mp.nl/forum-27.html)
+--- Thread: Useful Functions/Snippets/Commands (/thread-8203.html)

Pages: 1 2 3


Re: Useful Functions/Snippets/Commands - Zipper - 06-09-2008

alredy  found them here and here


Re: Useful Functions/Snippets/Commands - Lodewijk - 06-10-2008

Code:
    if(strcmp(cmd, "/Freeze", true) == 0)
    {
        if(IsPlayerAdmin(playerid))
        {
        new tmp[30];
        tmp = strtok(cmdtext, idx);
        new otherplayer = strval(tmp);
        if(IsPlayerConnected(otherplayer))
        {
            SendClientMessage(otherplayer, 0xFFFF00AA, "You have been Frozen!, Go read the (./)Rules");
            TogglePlayerControllable(otherplayer,0);
        }
        }
        return 1;
    }
meh


Re: Useful Functions/Snippets/Commands - WanSeoRin - 08-06-2008

how to put this script??

where??


Re: Useful Functions/Snippets/Commands - Zipper - 08-06-2008

Quote: link=topic=8713.msg134278#msg134278 date=1218018758]
how to put this script??

where??
search  goddamn it. There have been hundreds of answers on that question. For more info go here and here

Edit:
Code:
if(strcmp(cmd, "/unfreeze", true) == 0)
{
    if (IsPlayerAdmin(playerid))
    {
            new tmp[30];
            new giveplayerid;
            new giveplayer[24];
            new sendername[24];
            new string[128];
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
        {
            SendClientMessage(playerid, 0xB360FDFF, "USAGE: /unfreeze [playerid]");
        SendClientMessage(playerid, 0xB360FDFF, "FUNCTION: Will unfreeze the specified player. ");
        return 1;
        }
        giveplayerid = ReturnUser(tmp);
        if(giveplayerid != INVALID_PLAYER_ID)
        {
            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
            GetPlayerName(playerid, sendername, sizeof(sendername));
            format(string, sizeof(string), " You have been unfrozen by Administrator %s ", sendername);
            SendClientMessage(giveplayerid,0x38FF06FF, string);
            format(string, sizeof(string), " You have successfully unfrozen %s ", giveplayer);
            SendClientMessage(playerid,0x33AA33AA, string);
            TogglePlayerControllable(giveplayerid,1);
        }
          else if(giveplayerid == INVALID_PLAYER_ID)
        {
            format(string, sizeof(string), "%d is not an active player.", giveplayerid);
        SendClientMessage(playerid,0xE60000FF, string);
            }
    }
    else
    {
        SendClientMessage(playerid,0xE60000FF, "You are not an admin.");
      }
    return 1;
}
^^^^untested


Re: Useful Functions/Snippets/Commands - Jay - 02-02-2009

Meh, was bored before so I whipped up this:

(02-02-2009, 06:04 PM)Jay_ link Wrote: GivePlayerSpawnWeapon

This is a useful function that a lot of people often request. It gives a player a spawn weapon.

Put this above OnGameModeInit:
Code:
static stock iPlayerSpawnWeapon[MAX_PLAYERS][50];

And put this at the bottom of your code:
Code:
stock GivePlayerSpawnWeapon(iPlayerID,iWeaponID,iAmmo)
{
    // Is the player connected?
    if(!IsPlayerConnected(iPlayerID))
        return false;
    // Is the weapon ID valid?
    if(iWeaponID < 1 || iWeaponID > 50)
        return false;

    // If a player already has this spawn weapon, just add the ammo.
    if(iPlayerSpawnWeapon[iPlayerID][iWeaponID] > 0)
    {
        iPlayerSpawnWeapon[iPlayerID][iWeaponID] += iAmmo;
        GivePlayerWeapon(iPlayerID,iWeaponID,iAmmo);
        return 1;
    }
    
    iPlayerSpawnWeapon[iPlayerID][iWeaponID] = iAmmo;
    GivePlayerWeapon(iPlayerID,iWeaponID,iAmmo);
    return true;
}

Now, under OnPlayerSpawn, add this:
Code:
    for(new iWeaponID; iWeaponID < 50; iWeaponID++)
    {
        if(iPlayerSpawnWeapon[playerid][iWeaponID] > 0)
            GivePlayerWeapon(playerid,iWeaponID,iPlayerSpawnWeapon[playerid][iWeaponID]);
    }

Jay

I know Raymond was after something like this..


Re: Useful Functions/Snippets/Commands - Matthias - 02-04-2009

Wow thanks I've been looking for that a long time!


Re: Useful Functions/Snippets/Commands - Someoneis - 02-15-2009

Hey. I was wondering if anyone has got a admin vehicle filterscript. Like only admins can fly a hydra and hunter. And also, if i can give other people access to fly the admin vehicles by a command? And also, how to set up admin colours so when you log in, if your admin, it makes your colour red and if your mod, it makes your color blue?


Re: Useful Functions/Snippets/Commands - Matthias - 02-17-2009

If you can't script admin cmd's, download one at the SA:MP forums.


Re: Useful Functions/Snippets/Commands - FarePak - 02-17-2009

Quote:Matthias link=topic=8713.msg180730#msg180730 date=1234898985]
If you can't script admin cmd's, download one at the SA:MP forums.

Chances are that it won't be what he's really requesting.

@Someoneis, I doubt theres a script exactly what you're asking for but you should learn PAWN if you really want something that want, or you could pay someone but not reccomended.