Problem with car spawning command
#1

Hello!
I'm making a tournament, but I got into a problem. There's a command /vagis, which give player a car, but ONLY if the tournament is started.
The problem is that if if(stipnieks != 1) { is turned on 1, there's no meaning if tournament is started or not, I will get an message "Turnīrs vēl nav sācies", in english - tournament is not started yet, but if I turn it on 0, player can get an car even if the tournament is not started.
I try'd to fix it, but I fail'd.

There's the script:
Quote:

if (strcmp(cmdtext, "/vagis", true)==0) {
new Float:X, Float:Y, Float:Z, Float:Angle;
if(stipnieks != 0) {
return SendClientMessage(playerid, COLOR_GREY, "Turnirs vel nav sacies!");
}
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, Angle);
if(carer[playerid] == 1) {
if(IsAnyPlayerInVehicle(Veh[playerid])) {
for(new i=0; i<GetMaxPlayers(); i++) {
if(GetPlayerVehicleID(i) == Veh[playerid]) {
RemovePlayerFromVehicle(i);
}
}
}
PutPlayerInVehicle(playerid, Veh[playerid], 0);
SetVehiclePos(Veh[playerid], X, Y, Z);
SetVehicleZAngle(Veh[playerid], Angle);
} else {
carer[playerid] = 1;
Veh[playerid] = CreateVehicle(583, X, Y, Z+50, Angle, Colors[random(sizeof Colors)], Colors[random(sizeof Colors)], 10000);
PutPlayerInVehicle(playerid, Veh[playerid], 0);
SetVehiclePos(Veh[playerid], X, Y, Z);
SetVehicleZAngle(Veh[playerid], Angle);
return 1;
}

Reply
#2

You should try identing your code using the "TAB" Key next time ...

pawn Код:
if (strcmp(cmdtext, "/vagis", true) == 0)
{
    new Float:X, Float:Y, Float:Z, Float:Angle;
    if(stipnieks != 0) return SendClientMessage(playerid, COLOR_GREY, "Turnirs vel nav sacies!");
    else
    {
    GetPlayerPos(playerid, X, Y, Z);
    GetPlayerFacingAngle(playerid, Angle);
    if(carer[playerid] == 1)
    {
        if(IsAnyPlayerInVehicle(Veh[playerid]))
        {
            for(new i=0; i<GetMaxPlayers(); i++)
            {
                if(GetPlayerVehicleID(i) == Veh[playerid])
                {
                    RemovePlayerFromVehicle(i);
                }
            }
        }
    PutPlayerInVehicle(playerid, Veh[playerid], 0);
    SetVehiclePos(Veh[playerid], X, Y, Z);
    SetVehicleZAngle(Veh[playerid], Angle);
    }
    else
    {
        carer[playerid] = 1;
        Veh[playerid] = CreateVehicle(583, X, Y, Z+50, Angle, Colors[random(sizeof Colors)], Colors[random(sizeof Colors)], 10000);
        PutPlayerInVehicle(playerid, Veh[playerid], 0);
        SetVehiclePos(Veh[playerid], X, Y, Z);
        SetVehicleZAngle(Veh[playerid], Angle);
        return 1;
    }
}
Reply
#3

Quote:

C:\Documents and Settings\1234\Desktop\Serveris un citas fīčas\SA-MP Serveris\gamemodes\WID1.pwn(131) : error 017: undefined symbol "IsAnyPlayerInVehicle"
C:\Documents and Settings\1234\Desktop\Serveris un citas fīčas\SA-MP Serveris\gamemodes\WID1.pwn(157) : error 029: invalid expression, assumed zero
C:\Documents and Settings\1234\Desktop\Serveris un citas fīčas\SA-MP Serveris\gamemodes\WID1.pwn(157) : error 004: function "OnVehicleDeath" is not implemented
C:\Documents and Settings\1234\Desktop\Serveris un citas fīčas\SA-MP Serveris\gamemodes\WID1.pwn(160) : error 017: undefined symbol "vehicleid"
C:\Documents and Settings\1234\Desktop\Serveris un citas fīčas\SA-MP Serveris\gamemodes\WID1.pwn(161) : error 017: undefined symbol "vehicleid"
C:\Documents and Settings\1234\Desktop\Serveris un citas fīčas\SA-MP Serveris\gamemodes\WID1.pwn(16 : warning 225: unreachable code
C:\Documents and Settings\1234\Desktop\Serveris un citas fīčas\SA-MP Serveris\gamemodes\WID1.pwn(16 : error 029: invalid expression, assumed zero
C:\Documents and Settings\1234\Desktop\Serveris un citas fīčas\SA-MP Serveris\gamemodes\WID1.pwn(16 : error 017: undefined symbol "IsAnyPlayerInVehicle"
C:\Documents and Settings\1234\Desktop\Serveris un citas fīčas\SA-MP Serveris\gamemodes\WID1.pwn(170) : error 017: undefined symbol "vehicleid"
C:\Documents and Settings\1234\Desktop\Serveris un citas fīčas\SA-MP Serveris\gamemodes\WID1.pwn(175) : warning 225: unreachable code
C:\Documents and Settings\1234\Desktop\Serveris un citas fīčas\SA-MP Serveris\gamemodes\WID1.pwn(175) : error 029: invalid expression, assumed zero
C:\Documents and Settings\1234\Desktop\Serveris un citas fīčas\SA-MP Serveris\gamemodes\WID1.pwn(175) : error 004: function "OnPlayerPickUpPickup" is not implemented
C:\Documents and Settings\1234\Desktop\Serveris un citas fīčas\SA-MP Serveris\gamemodes\WID1.pwn(204) : error 030: compound statement not closed at the end of file (started at line 91)

FTW!
Reply
#4

Check your brackets.
Reply
#5

I don't know what to check for, scripting is not my strong side.
Reply
#6

pawn Код:
if (strcmp(cmdtext, "/vagis", true) == 0)
{
new Float:X, Float:Y, Float:Z, Float:Angle;
if(stipnieks != 0) return SendClientMessage(playerid, COLOR_GREY, "Turnirs vel nav sacies!");
else
{
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, Angle);
if(carer[playerid] == 1)
{
if(IsPlayerInAnyVehicle(Veh[playerid]))
{
for(new i=0; i<GetMaxPlayers(); i++)
{
if(GetPlayerVehicleID(i) == Veh[playerid])
{
RemovePlayerFromVehicle(i);
}
}
}
}
}
}
There you go, I did it for you. But don't just copy and paste it without even looking at it, otherwise you won't learn anything.

@//exora: Check your brackets next time.
Reply
#7

Really big thank's for helping me eddy, but I still get some errors, maybe I can give you whole script, its small, just ~184 lines?

anyway here's the errors:
Quote:

C:\Documents and Settings\1234\Desktop\Serveris un citas fīčas\SA-MP Serveris\gamemodes\WID1.pwn(143) : error 029: invalid expression, assumed zero
C:\Documents and Settings\1234\Desktop\Serveris un citas fīčas\SA-MP Serveris\gamemodes\WID1.pwn(143) : error 004: function "OnVehicleDeath" is not implemented
C:\Documents and Settings\1234\Desktop\Serveris un citas fīčas\SA-MP Serveris\gamemodes\WID1.pwn(146) : error 017: undefined symbol "vehicleid"
C:\Documents and Settings\1234\Desktop\Serveris un citas fīčas\SA-MP Serveris\gamemodes\WID1.pwn(147) : error 017: undefined symbol "vehicleid"
C:\Documents and Settings\1234\Desktop\Serveris un citas fīčas\SA-MP Serveris\gamemodes\WID1.pwn(152) : error 029: invalid expression, assumed zero
C:\Documents and Settings\1234\Desktop\Serveris un citas fīčas\SA-MP Serveris\gamemodes\WID1.pwn(152) : error 017: undefined symbol "IsAnyPlayerInVehicle"
C:\Documents and Settings\1234\Desktop\Serveris un citas fīčas\SA-MP Serveris\gamemodes\WID1.pwn(153) : warning 219: local variable "i" shadows a variable at a preceding level
C:\Documents and Settings\1234\Desktop\Serveris un citas fīčas\SA-MP Serveris\gamemodes\WID1.pwn(154) : error 017: undefined symbol "vehicleid"
C:\Documents and Settings\1234\Desktop\Serveris un citas fīčas\SA-MP Serveris\gamemodes\WID1.pwn(159) : warning 225: unreachable code
C:\Documents and Settings\1234\Desktop\Serveris un citas fīčas\SA-MP Serveris\gamemodes\WID1.pwn(159) : error 029: invalid expression, assumed zero
C:\Documents and Settings\1234\Desktop\Serveris un citas fīčas\SA-MP Serveris\gamemodes\WID1.pwn(159) : error 004: function "OnPlayerPickUpPickup" is not implemented
C:\Documents and Settings\1234\Desktop\Serveris un citas fīčas\SA-MP Serveris\gamemodes\WID1.pwn(18 : error 030: compound statement not closed at the end of file (started at line 145)

To fix error about IfAnyPlayerIsInVechicle I try'd to add a line new IfAnyPlayerIsInVechicle, but that was propably stupid, and to fix vehicleid I did the same.
Reply
#8

You missed a bracket again. XD
Mmmmkay, lemme fix it for you. Post your script on pastebin. :P
Reply
#9

http://pastebin.com/m3aa6e016

Sh/t you're cool!
Reply
#10

Seriously, you're not even copy pasting properly and blaming us.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)