SA-MP Forums Archive
How to call a function? (+Rep for help) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to call a function? (+Rep for help) (/showthread.php?tid=468743)



How to call a function? (+Rep for help) - Alex_Obando - 10.10.2013

pawn Код:
forward EndAntiSpawnKill(playerid);
public EndAntiSpawnKill(playerid)
{
        format(Vnewban,32,BanDir,VBPlayer(playerid));
        VBanLoadInfo(playerid,Vnewban);
        new name[MAX_PLAYER_NAME+1];
        GetPlayerName(playerid, name, sizeof(name));
        new string[264];
        new ip[16];
        GetPlayerIp(playerid, ip, sizeof(ip));
        format(string, sizeof(string), "%s [ID: %d] [IP: %s] is suspected of ban evading. (Old Name: %s)", name, playerid, ip, dini_Get(Vnewban,"Nick")); //I want it to show up the old name
        MessageToAdmins(0xFD01FDAA,string);
        printf(string);

       
}
stock VBanLoadInfo(playerid,Varq[]) //Varq is the variable how can I call it up there?
{
    if(!dini_Exists(Varq))
        return SendClientMessage(playerid, -1,"NOTE: No Banned Found!");

    new Str[300];
    new Str1[300];
    new Str2[300];
    new Str3[300];
    new Str4[300];
    new Str5[300];
    format(Str,300,"Nickname: %s",dini_Get(Varq,"Nick")); //get this on top
    format(Str1,300,"IP: %s",dini_Get(Varq,"IP"));
    format(Str2,300,"Admin: %s",dini_Get(Varq,"Admin"));
    format(Str3,300,"Reason: %s",dini_Get(Varq,"Reason"));
    format(Str4,300,"Date: %s",dini_Get(Varq,"Date"));
    format(Str5,300,"Hour: %s",dini_Get(Varq,"Hour"));

    MessageToAdmins(red,Str);
    MessageToAdmins(red,Str1);
    MessageToAdmins(red,Str2);
    MessageToAdmins(red,Str3);
    MessageToAdmins(red,Str4);
    MessageToAdmins(red,Str5);
    return 1;
}
Its basically showing the message, but it wont show up the old name, I dont know how to call it, please help.


Re: How to call a function? (+Rep for help) - Mattakil - 10.10.2013

what is the varq?


Respuesta: How to call a function? (+Rep for help) - Alex_Obando - 10.10.2013

pawn Код:
stock VBanLoadInfo(playerid,Varq[])
That would be the target player (Ban Evader)


Respuesta: How to call a function? (+Rep for help) - JustBored - 10.10.2013

https://sampwiki.blast.hk/wiki/CallLocalFunction


Respuesta: How to call a function? (+Rep for help) - Alex_Obando - 10.10.2013

Example please?


Re: How to call a function? (+Rep for help) - Mattakil - 10.10.2013

pawn Код:
forward EndAntiSpawnKill(playerid);
public EndAntiSpawnKill(playerid)
{
        format(Vnewban,32,BanDir,VBPlayer(playerid));
        VBanLoadInfo(playerid,Vnewban);
        new name[MAX_PLAYER_NAME+1];
        GetPlayerName(playerid, name, sizeof(name));
        new string[264];
        new ip[16];
        GetPlayerIp(playerid, ip, sizeof(ip));
        format(string, sizeof(string), "%s [ID: %d] [IP: %s] is suspected of ban evading. (Old Name: %s)", name, playerid, ip, dini_Get(Vnewban,"Nick")); //I want it to show up the old name
        MessageToAdmins(0xFD01FDAA,string);
        printf(string);
        VBanLoadInfo(playerid);//notice I changed it to just playerid
       
}
Some things are wrong in the stock as well...
pawn Код:
stock VBanLoadInfo(Varq) //Varq is the id of the player
{
    if(!dini_Exists(Varq))
    return MessageToAdmins(red, "No Banned Found!");//changed to adminmessage

    new Str[300];
    new Str1[300];
    new Str2[300];
    new Str3[300];
    new Str4[300];
    new Str5[300];
    format(Str,300,"Nickname: %s",dini_Get(Varq,"Nick")); //get this on top
    format(Str1,300,"IP: %s",dini_Get(Varq,"IP"));
    format(Str2,300,"Admin: %s",dini_Get(Varq,"Admin"));
    format(Str3,300,"Reason: %s",dini_Get(Varq,"Reason"));
    format(Str4,300,"Date: %s",dini_Get(Varq,"Date"));
    format(Str5,300,"Hour: %s",dini_Get(Varq,"Hour"));

    MessageToAdmins(red,Str);
    MessageToAdmins(red,Str1);
    MessageToAdmins(red,Str2);
    MessageToAdmins(red,Str3);
    MessageToAdmins(red,Str4);
    MessageToAdmins(red,Str5);
    return 1;
}
try that


Respuesta: How to call a function? (+Rep for help) - Alex_Obando - 10.10.2013

Not working.
I just want this to show up the old name (The one he got banned with)

pawn Код:
format(Str,300,"Nickname: %s",dini_Get(Varq,"Nick"));
Which is that.


Re: How to call a function? (+Rep for help) - Mattakil - 10.10.2013

oh shit, sorry, I didn't see that...The best way would be to use a command...Ignore what I said above :P

pawn Код:
CMD:checkban(playerid, params[])
    {
    new varq[MAX_PLAYER_NAME];
    if(sscanf(params, "s", varq)) return SendClientMessage(playerid, -1, "Usage: /checkban [name]");
    VBanLoadInfo(playerid, varq);
    return 1;
    }



Re: How to call a function? (+Rep for help) - EiresJason - 10.10.2013

pawn Код:
forward EndAntiSpawnKill(playerid);
public EndAntiSpawnKill(playerid)
{
        format(Vnewban,32,BanDir,VBPlayer(playerid)); //VBPlayer has to be a string for this to work.
        //EDIT: What is 'BanDir' and what is 'VBPlayer' and 'Vnewban'.
        VBanLoadInfo(playerid,Vnewban);
        new name[MAX_PLAYER_NAME+1];
        GetPlayerName(playerid, name, sizeof(name));
        new string[264];
        new ip[16];
        GetPlayerIp(playerid, ip, sizeof(ip));
        format(string, sizeof(string), "%s [ID: %d] [IP: %s] is suspected of ban evading. (Old Name: %s)", name, playerid, ip, dini_Get(Vnewban,"Nick")); //I want it to show up the old name
        MessageToAdmins(0xFD01FDAA,string);
        printf(string);
}



Respuesta: How to call a function? (+Rep for help) - Alex_Obando - 10.10.2013

Not working