SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 18/06/2012, 08:21 PM   #1
vIBIENNYx
Huge Clucker
 
vIBIENNYx's Avatar
 
Join Date: Apr 2011
Posts: 218
Reputation: 9
Default SendMessageToAdmins stock

Hey, basically, every time an admin is performing a somewhat abusable command I want it so that all admins can see it, just in case, this is my stock:

pawn Code:
stock SendMessageToAdmins(string)
{
    for(new i = 0; i != MAX_PLAYERS; i++)
    {
        if(PVar[i][alevel] > 0)
        {
            SendClientMessage(i, 0xCC000000, string);
        }
    }
    return 1;
}

This is the code I am trying to put it in.

pawn Code:
command(giveweapon, playerid, params[])
{
    if(loggedin[playerid] == 0) return SendClientMessage(playerid, 0x66666666, "You must be logged in perform commands");
    if(PVar[playerid][alevel] >2)
    {
        new str[128], sWeapon;
        new id, ammo;

        if(sscanf(params, "uk<weapons>d", id, sWeapon, ammo)) return SendClientMessage(playerid, 0x66666666, "Usage: /giveweapon [Player ID] [Weapon ID] [Ammo] * You can only give 5000 ammo with the weapon *");
        {
            if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0x66666666, "That player is not connected.");
            if(sWeapon == -1) return SendClientMessage(playerid, 0x66666666, "That weapon model or ID doesn't exist.");
            if(ammo > 5000 || ammo < 0) return SendClientMessage(playerid, 0x66666666, "You can only give between 1-5000 ammo.");
            if(playerid == id)
            {
                format(str, sizeof(str), "You have given yourself a %s [ID %d] with '%d' ammo.", WeaponNames[sWeapon], sWeapon, ammo);
                SendClientMessage(id, 0x66999999, str);
                GivePlayerWeapon(id, sWeapon, ammo);
            }
            else
            {
                format(str, sizeof(str), "You have given %s a '%s [ID %d]' with '%d' ammo.", RemoveUnderScore(id), WeaponNames[sWeapon], sWeapon, ammo);
                SendClientMessage(playerid, 0x66999999, str);
                format(str, sizeof(str), "You have been given a '%s [ID %d]' with '%d' ammo by %s.", WeaponNames[sWeapon], sWeapon, ammo, RemoveUnderScore(playerid));
                SendClientMessage(id, 0x66999999, str);
                format(str, sizeof(str), "%s has given %s a '%s (ID %d)' with '%d' ammo.", RemoveUnderScore(playerid), RemoveUnderScore(id), WeaponNames[sWeapon], sWeapon, ammo);
                SendMessageToAdmins(str)
                GivePlayerWeapon(id, sWeapon, ammo);
            }
        }
    }
    else
    {
        SendClientMessage(playerid, 0x66666666, "You are not authorised to use that command.");
        return 1;
    }
    return 1;
}

However, it does not work and I get these errors:

pawn Code:
C:\Users\Ben\Desktop\SF-RP\gamemodes\bensamp.pwn(1898) : error 035: argument type mismatch (argument 1)
C:\Users\Ben\Desktop\SF-RP\gamemodes\bensamp.pwn(2459) : error 035: argument type mismatch (argument 3)
C:\Users\Ben\Desktop\SF-RP\gamemodes\bensamp.pwn(2453) : warning 203: symbol is never used: "string"

Any ideas?
vIBIENNYx is offline   Reply With Quote
Old 18/06/2012, 08:27 PM   #2
iGetty
High-roller
 
iGetty's Avatar
 
Join Date: Sep 2010
Location: Falkirk, Scotland
Posts: 1,753
Reputation: 224
Default Re: SendMessageToAdmins stock

What are the lines Ben?
iGetty is offline   Reply With Quote
Old 18/06/2012, 08:29 PM   #3
WagnerPM
Big Clucker
 
Join Date: Apr 2012
Location: US
Posts: 89
Reputation: 18
Default Re: SendMessageToAdmins stock

pawn Code:
command(giveweapon, playerid, params[])
{
    if(loggedin[playerid] == 0) return SendClientMessage(playerid, 0x66666666, "You must be logged in perform commands");
    if(PVar[playerid][alevel] >2)
    {
        new sWeapon;
        new id, ammo;

        if(sscanf(params, "uk<weapons>d", id, sWeapon, ammo)) return SendClientMessage(playerid, 0x66666666, "Usage: /giveweapon [Player ID] [Weapon ID] [Ammo] * You can only give 5000 ammo with the weapon *");
        {
            if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0x66666666, "That player is not connected.");
            if(sWeapon == -1) return SendClientMessage(playerid, 0x66666666, "That weapon model or ID doesn't exist.");
            if(ammo > 5000 || ammo < 0) return SendClientMessage(playerid, 0x66666666, "You can only give between 1-5000 ammo.");
            if(playerid == id)
            {
                format(string, sizeof(string), "You have given yourself a %s [ID %d] with '%d' ammo.", WeaponNames[sWeapon], sWeapon, ammo);
                SendClientMessage(id, 0x66999999, string);
                GivePlayerWeapon(id, sWeapon, ammo);
            }
            else
            {
                format(string, sizeof(string), "You have given %s a '%s [ID %d]' with '%d' ammo.", RemoveUnderScore(id), WeaponNames[sWeapon], sWeapon, ammo);
                SendClientMessage(playerid, 0x66999999, string);
                format(string, sizeof(string), "You have been given a '%s [ID %d]' with '%d' ammo by %s.", WeaponNames[sWeapon], sWeapon, ammo, RemoveUnderScore(playerid));
                SendClientMessage(id, 0x66999999, string);
                format(string, sizeof(string), "%s has given %s a '%s (ID %d)' with '%d' ammo.", RemoveUnderScore(playerid), RemoveUnderScore(id), WeaponNames[sWeapon], sWeapon, ammo);
                SendMessageToAdmins(-1,string);
                GivePlayerWeapon(id, sWeapon, ammo);
            }
        }
    }
    else
    {
        SendClientMessage(playerid, 0x66666666, "You are not authorised to use that command.");
        return 1;
    }
    return 1;
}
WagnerPM is offline   Reply With Quote
Old 18/06/2012, 08:30 PM   #4
iGetty
High-roller
 
iGetty's Avatar
 
Join Date: Sep 2010
Location: Falkirk, Scotland
Posts: 1,753
Reputation: 224
Default Re: SendMessageToAdmins stock

You added:

pawn Code:
SendMessageToAdmins(-1,string);

The stock is:
pawn Code:
SendMessageToAdmins(string)

There is no-where for the "-1" to fit into the equation.
iGetty is offline   Reply With Quote
Old 18/06/2012, 08:43 PM   #5
vIBIENNYx
Huge Clucker
 
vIBIENNYx's Avatar
 
Join Date: Apr 2011
Posts: 218
Reputation: 9
Default Re: SendMessageToAdmins stock

Quote:
Originally Posted by iGetty View Post
You added:

pawn Code:
SendMessageToAdmins(-1,string);

The stock is:
pawn Code:
SendMessageToAdmins(string)

There is no-where for the "-1" to fit into the equation.
Exactly what I was thinking, the problem is that the "String" in the stock is not being used.

The errors are on these lines:

pawn Code:
C:\Users\Ben\Desktop\SF-RP\gamemodes\bensamp.pwn(1898) : error 035: argument type mismatch (argument 1)
SendMessageToAdmins(str);
pawn Code:
C:\Users\Ben\Desktop\SF-RP\gamemodes\bensamp.pwn(2459) : error 035: argument type mismatch (argument 3)
SendClientMessage(i, 0xCC000000, str);
pawn Code:
C:\Users\Ben\Desktop\SF-RP\gamemodes\bensamp.pwn(2453) : warning 203: symbol is never used: "str"
stock SendMessageToAdmins(str)
vIBIENNYx is offline   Reply With Quote
Old 18/06/2012, 09:06 PM   #6
FUNExtreme
Gangsta
 
Join Date: Mar 2008
Posts: 790
Reputation: 128
Default Re: SendMessageToAdmins stock

Strings are like this: new string[128];
I guess that those are errors 1 and 2

For the third: stock SendMessageToAdmins(str[] )
FUNExtreme is offline   Reply With Quote
Old 18/06/2012, 09:19 PM   #7
vIBIENNYx
Huge Clucker
 
vIBIENNYx's Avatar
 
Join Date: Apr 2011
Posts: 218
Reputation: 9
Default Re: SendMessageToAdmins stock

Quote:
Originally Posted by FUNExtreme View Post
Strings are like this: new string[128];
I guess that those are errors 1 and 2

For the third: stock SendMessageToAdmins(str[] )
Okay, I have done that and the errors have gone, the issue is that it does not actually show now..
vIBIENNYx is offline   Reply With Quote
Old 18/06/2012, 09:21 PM   #8
vIBIENNYx
Huge Clucker
 
vIBIENNYx's Avatar
 
Join Date: Apr 2011
Posts: 218
Reputation: 9
Default Re: SendMessageToAdmins stock

Nevermind, fixed.. Thanks guys.
vIBIENNYx is offline   Reply With Quote
Old 18/06/2012, 09:40 PM   #9
iGetty
High-roller
 
iGetty's Avatar
 
Join Date: Sep 2010
Location: Falkirk, Scotland
Posts: 1,753
Reputation: 224
Default Re: SendMessageToAdmins stock

Welcome Ben. Drop me a text (:
iGetty 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
[AJUDA] Stock stock GetVehicleModelID(nome[]) Baigou PortuguÍs/Portuguese 1 08/11/2011 11:21 PM
[HELP] SendMessageToAdmins Larsey123IsMe Help Archive 2 16/12/2010 02:40 PM
SendMessageToAdmins Face9000 Help Archive 4 16/12/2010 10:52 AM
Out of Stock Galcio Help Archive 8 02/09/2009 01:16 AM


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


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