Command won't work + How to spawn car
#1

Hi!

I'm working on a simple admin SF but I can't use the command that I made.. It dosen't happen
anything when I type the command...


pawn Код:
public OnFilterScriptInit()
{

    print("\n--------------------------------------");
    print(" Blank Filterscript by your name here");
    print("--------------------------------------\n");
    return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/weapon", cmdtext, true, 10) == 0)
    {
        if(!IsPlayerAdmin(playerid))
        return SendClientMessage(playerid,-1,"You are not logged into Rcon"); //    Sends client message that he is not logged into rcon
        GivePlayerWeapon(playerid,38,500); // Gives player weapon if he is logged into RCON
        return 1;
    }
    return 0;
}
public OnFilterScriptExit()
{
    return 1;
}

#else
#endif
Reply
#2

this is how i spawn cars
pawn Код:
CMD:infernus(playerid, params[])
{
        new float:X, float:Y, float:Z, float:angle;
        GetPlayerPos(playerid, X, Y, Z);
        GetPlayerFacingAngle( playerid, angle );
        new car = CreateVehicle(411, X, Y, Z, angle, 0, 1, 60);
        PutPlayerInVehicle(playerid, car, 0);
        SendClientMessage(playerid, -1, "u spawned a infernus!");
but its not a very good method (you have to make a command for each car) but i dont know how to make a cmd /v [model name] lol
Reply
#3

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/weapon", cmdtext, true, 10) == 0)
    {
        if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "Your not logged in as a rcon admin");
       
        GivePlayerWeapon(playerid,38,500); // Gives player weapon if he is logged into RCON
        return 1;
    }
    return 0;
}
Reply
#4

Quote:
Originally Posted by davve95
Посмотреть сообщение

pawn Код:
public OnFilterScriptInit()
{

    print("\n--------------------------------------");
    print(" Blank Filterscript by your name here");
    print("--------------------------------------\n");
    return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/weapon", cmdtext, true, 10) == 0)
    {
        if(!IsPlayerAdmin(playerid))
        return SendClientMessage(playerid,-1,"You are not logged into Rcon"); //    Sends client message that he is not logged into rcon
        GivePlayerWeapon(playerid,38,500); // Gives player weapon if he is logged into RCON
        return 1;
    }
    return 0;
}
public OnFilterScriptExit()
{
    return 1;
}

#else
#endif
Dont you need to add Else?
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/weapon", cmdtext, true, 10) == 0)
    {
        if(!IsPlayerAdmin(playerid))
        return SendClientMessage(playerid,-1,"You are not logged into Rcon"); //    Sends client message that he is not logged into rcon
        else
        GivePlayerWeapon(playerid,38,500); // Gives player weapon if he is logged into RCON
        return 1;
    }
    return 0;
}
Edit:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/weapon", cmdtext, true, 10) == 0)
{
    if(IsPlayerAdmin(playerid))
    {
        GivePlayerWeapon(playerid,38,500); // Gives player weapon if he is logged into RCON
   else
   SendClientMessage(playerid,-1,"You are not logged into Rcon"); //    Sends client message that he is not logged into rcon
        return 1;
    }
    return 0;
}
Reply
#5

Thanks I will try that.. Ops I forgot to write that about spawn car LOL.. Anyway: Hoe could I make that if I type example /infernus and I got one..
Reply
#6

i gave you the code...
Reply
#7

This should be like this..
Код:
#define FILTERSCRIPT
#include <a_samp>

#if defined FILTERSCRIPT
public OnFilterScriptInit()
{

    print("\n--------------------------------------");
    print(" Blank Filterscript by your name here");
    print("--------------------------------------\n");
    return 1;
}
public OnFilterScriptExit()
{
    return 1;
}
#endif

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/weapon", cmdtext, true, 10) == 0)
    {
        if(!IsPlayerAdmin(playerid))
        return SendClientMessage(playerid,-1,"You are not logged into Rcon"); //    Sends client message that he is not logged into rcon
        GivePlayerWeapon(playerid,38,500); // Gives player weapon if he is logged into RCON
        return 1;
    }
    return 0;
}
And for Infernus,thefatshizms exemple is good.
Reply
#8

Okay, thanks alot all!.
Reply
#9

If you're writing a new filterscript in 2012 - shouldn't you be using the latest advances, i.e. ZCMD/YCMD and sscanf?
Reply
#10

Quote:
Originally Posted by TzAkS.
Посмотреть сообщение
This should be like this..
Код:
#define FILTERSCRIPT
#include <a_samp>

#if defined FILTERSCRIPT
public OnFilterScriptInit()
{

    print("\n--------------------------------------");
    print(" Blank Filterscript by your name here");
    print("--------------------------------------\n");
    return 1;
}
public OnFilterScriptExit()
{
    return 1;
}
#endif

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/weapon", cmdtext, true, 10) == 0)
    {
        if(!IsPlayerAdmin(playerid))
        return SendClientMessage(playerid,-1,"You are not logged into Rcon"); //    Sends client message that he is not logged into rcon
        GivePlayerWeapon(playerid,38,500); // Gives player weapon if he is logged into RCON
        return 1;
    }
    return 0;
}
And for Infernus,thefatshizms exemple is good.
Awesome thanks! It workt .. But why should it be under public OnFilterScriptExit() ??..
And not under OnFilterScriptInt() ..


MP2: Idk maybe..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)