Cmd issue
#1

Hey there!
I am trying to make a command which only works if you are inside a specific vehicle(572), and I seem to have some issues with it. I am an amateur at scripting so please help
pawn Код:
#include <a_samp>
forward IsPlayerInsideVehicle(playerid, modelid);
pawn Код:
#endif
#pragma tabsize 0
    new IsPlayerInsideVehicle[ MAX_PLAYERS ];
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
}
    if (strcmp("/grass start", cmdtext, true, 10) == 0)
    {
    if IsPlayerInsideVehicle(playerid, 572)=true


 {
 }
   SetPlayerCheckpoint(playerid, 779.9626, -1259.1793, 13.5719, 3.0);
     return 1;
     }
     else
     {
     SendClientMessage(playerid,0xFFFFFFAA, "You are not driving a lawnmower");
     return 1;
     }

     return 0;

 }
Код:
C:\Users\Bastian\Documents\Samp_server\gamemodes\Test.pwn(431) : warning 211: possibly unintended assignment
C:\Users\Bastian\Documents\Samp_server\gamemodes\Test.pwn(431) : error 022: must be lvalue (non-constant)
C:\Users\Bastian\Documents\Samp_server\gamemodes\Test.pwn(431 -- 434) : error 028: invalid subscript (not an array or too many subscripts): "true"
C:\Users\Bastian\Documents\Samp_server\gamemodes\Test.pwn(445) : warning 225: unreachable code
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Please try to help me, it will surely be appreciated!
Reply
#2

Could you show me the full FS? I don't see any "true".
Reply
#3

Quote:
Originally Posted by cοοp
Could you show me the full FS? I don't see any "true".
You mean this?
pawn Код:
if IsPlayerInsideVehicle(playerid, 572)=true
Reply
#4

Okay I edited something and I ended up with this:
pawn Код:
}
    if (strcmp("/grass start", cmdtext, true, 10) == 0)
    {
    if IsPlayerInsideVehicle(playerid, 572)*then


 {
 }
   SetPlayerCheckpoint(playerid, 779.9626, -1259.1793, 13.5719, 3.0);
     return 1;
     }
     else
     {
     SendClientMessage(playerid,0xFFFFFFAA, "You are not driving a lawnmower");
     return 1;
     }

     return 0;

 }
Код:
C:\Users\Bastian\Documents\Samp_server\gamemodes\Test.pwn(431) : warning 209: function "IsPlayerInsideVehicle" should return a value
C:\Users\Bastian\Documents\Samp_server\gamemodes\Test.pwn(445) : warning 225: unreachable code
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Warnings.
Reply
#5

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/grass", cmdtext, true, 6) == 0)
    {
        new vehicleid = GetPlayerVehicleID(playerid);

        if (GetVehicleModel(vehicleid) == 572)
        {
            SetPlayerCheckpoint(playerid, 779.9626, -1259.1793, 13.5719, 3.0);
        }
        else
        {
            SendClientMessage(playerid,0xE60000FF, "You Must Be Driving A Lawnmower To Use This Command.");
        }
        return 1;
    }
    return 0;
}
Reply
#6

Cheers that worked
Reply
#7

Quote:
Originally Posted by Shinzei_Banzai
You mean this?
pawn Код:
if IsPlayerInsideVehicle(playerid, 572)=true
Oh, sorry. I didn't notice that. XD
Reply
#8

Quote:
Originally Posted by Shinzei_Banzai
Cheers that worked
https://sampwiki.blast.hk/wiki/Scripting_Basics#Variables
Reply
#9

Quote:
Originally Posted by cοοp
Quote:
Originally Posted by Shinzei_Banzai
You mean this?
pawn Код:
if IsPlayerInsideVehicle(playerid, 572)=true
Oh, sorry. I didn't notice that. XD
Hihi
Now I need this command to keep spawning red markers randomly when you enter one.
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
    GivePlayerMoney(playerid, 600);
    DisablePlayerCheckpoint(playerid);
    return 1;
}
What should I do? I've heard of something called a "streamer"
Reply
#10

Quote:
Originally Posted by Shinzei_Banzai
Hihi
Now I need this command to keep spawning red markers randomly when you enter one.
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
    GivePlayerMoney(playerid, 600);
    DisablePlayerCheckpoint(playerid);
    return 1;
}
What should I do? I've heard of something called a "streamer"
You will need to add your own coordinates , i haven't tested it, but that give you basic idea how you can do it.

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/grass", cmdtext, true, 6) == 0)
    {
        new vehicleid = GetPlayerVehicleID(playerid);

        if (GetVehicleModel(vehicleid) == 572)
        {
            SendClientMessage(playerid,0xBBFFFFFF, "You Have Started A Lawnmower Mission.");
            SetPlayerRaceCheckpoint(playerid, 2, 779.9626, -1259.1793, 13.5719, 0, 0, 0, 4.0);
        }
        else
        {
            SendClientMessage(playerid,0xE60000FF, "You Must Be Driving A Lawnmower To Use This Command.");
        }
        return 1;
    }
    return 0;
}
pawn Код:
public OnPlayerEnterRaceCheckpoint(playerid)
{
    new vehicleid = GetPlayerVehicleID(playerid);

    if (GetVehicleModel(vehicleid) == 572)
    {
        if (PlayerToPoint(4, playerid, 779.9626, -1259.1793, 13.5719))
        {
            SetPlayerRaceCheckpoint(playerid, 2, X, Y, Z, 0, 0, 0, 6.0);// Set the X, Y, Z
            SendClientMessage(playerid, 0xBBFFFFFF, "You Have Arived At Checkpoint 1, Go To Checkpoint 2..");
        }
        else if (PlayerToPoint(4, playerid, X, Y, Z))// Set the X, Y, Z
        {
            SetPlayerRaceCheckpoint(playerid, 2, X, Y, Z, 0, 0, 0, 6.0);// Set the X, Y, Z
            SendClientMessage(playerid, 0xBBFFFFFF, "You Have Arived At Checkpoint 2, Go To Checkpoint 3..");
        }
        return 1;
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)