SA-MP Forums Archive
Command won't work + How to spawn car - 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: Command won't work + How to spawn car (/showthread.php?tid=345961)



Command won't work + How to spawn car - davve95 - 26.05.2012

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



Re: Command won't work + How to spawn car - thefatshizms - 26.05.2012

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


Re: Command won't work + How to spawn car - Kitten - 26.05.2012

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;
}



Re: Command won't work + How to spawn car - Audi_Quattrix - 26.05.2012

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;
}



Re: Command won't work + How to spawn car - davve95 - 26.05.2012

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..


Re: Command won't work + How to spawn car - thefatshizms - 26.05.2012

i gave you the code...


Re: Command won't work + How to spawn car - TzAkS. - 26.05.2012

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.


Re: Command won't work + How to spawn car - davve95 - 27.05.2012

Okay, thanks alot all!.


Re: Command won't work + How to spawn car - MP2 - 27.05.2012

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


Re: Command won't work + How to spawn car - davve95 - 27.05.2012

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..