SA-MP Forums Archive
[help] Commands Not Working - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [help] Commands Not Working (/showthread.php?tid=269591)



[help] Commands Not Working - mastalol - 17.07.2011

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/vr", true) == 1) {
        if(IsPlayerVipMember(playerid)) return SendClientMessage(playerid,red,"Only Vip's Can Repair Their Vehicles.");
        {
            if(IsPlayerInAnyVehicle(playerid)) {
                new vehicleid = GetPlayerVehicleID(playerid);
                SetVehicleHealth(vehicleid,1000.0);
                SendClientMessage(playerid,Green1, "Vehicle fixed.");
            }
            else {
                SendClientMessage(playerid,red, "You are not in a vehicle!");
            }

        }
    }
    return 1;
}
I have no errors/warnings and i see no problem with the script
but when i do /vr ingame it doesent do anything...
it DOES NOT tell me:

You are not in a vehicle!,
Vehicle fixed., or
Only Vip's Can Repair Their Vehicles.

its like i type it but the server does not respond

USING LUXADMIN FOR IsPlayerVipMember



Re: [help] Commands Not Working - PrawkC - 17.07.2011

change
if(strcmp(cmdtext, "/vr", true) == 1) {
to
if(strcmp(cmdtext, "/vr", true) == 0) {


When two strings match it returns 0.


Re: [help] Commands Not Working - lolumadd_ - 17.07.2011

pawn Код:
if(strcmp(cmdtext, "/vr", true) == 1)
should be

pawn Код:
if(strcmp(cmdtext, "/vr", true) == 0)
With strcmp, a value of 0 means it is true.


Re: [help] Commands Not Working - =WoR=Varth - 17.07.2011

EDIT: nvm


Re: [help] Commands Not Working - SergiKirov - 17.07.2011

whoops... misread his post


Re: [help] Commands Not Working - Shockey HD - 17.07.2011

Quote:
Originally Posted by mastalol
Посмотреть сообщение
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/vr", true) == 1) {
        if(IsPlayerVipMember(playerid)) return SendClientMessage(playerid,red,"Only Vip's Can Repair Their Vehicles.");
        {
            if(IsPlayerInAnyVehicle(playerid)) {
                new vehicleid = GetPlayerVehicleID(playerid);
                SetVehicleHealth(vehicleid,1000.0);
                SendClientMessage(playerid,Green1, "Vehicle fixed.");
            }
            else {
                SendClientMessage(playerid,red, "You are not in a vehicle!");
            }

        }
    }
    return 1;
}
I have no errors/warnings and i see no problem with the script
but when i do /vr ingame it doesent do anything...
it DOES NOT tell me:

You are not in a vehicle!,
Vehicle fixed., or
Only Vip's Can Repair Their Vehicles.

its like i type it but the server does not respond

USING LUXADMIN FOR IsPlayerVipMember
After using that command, did the server crash after typing in the command? If so theres something wrong with your script itself. And i see your trying to use a fix command for your car. Let me just clean up your script. So its little more correct. This is off the back of my hand. Make the code like this.

Код:
    if(strcmp(cmdtext, "/vr", true) == 0) 
          {
        if(IsPlayerVipMember(playerid)) return SendClientMessage(playerid,red,"Only Vip's Can Repair Their Vehicles.");
        {
            if(IsPlayerInAnyVehicle(playerid)) 
           {
                new vehicleid = GetPlayerVehicleID(playerid);
                SetVehicleHealth(vehicleid,1000.0);
                SendClientMessage(playerid,Green1, "Vehicle fixed.");
            }
            else 
       {
                SendClientMessage(playerid,red, "You are not in a vehicle!");
            }

        }
    }
    return 1;
}
Try that and tell me if it works


Re: [help] Commands Not Working - lolumadd_ - 17.07.2011

^That wont work. Mine is corrected:

Код:
    if(strcmp(cmdtext, "/vr", true) == 0) 
          {
        if(!IsPlayerVipMember(playerid)) return SendClientMessage(playerid,red,"Only Vip's Can Repair Their Vehicles.");
        else
        {
            if(IsPlayerInAnyVehicle(playerid)) 
           {
                new vehicleid = GetPlayerVehicleID(playerid);
                SetVehicleHealth(vehicleid,1000.0);
                SendClientMessage(playerid,Green1, "Vehicle fixed.");
            }
            else 
       {
                SendClientMessage(playerid,red, "You are not in a vehicle!");
            }

        }
    }
    return 1;
}
Try that


Re: [help] Commands Not Working - PrawkC - 17.07.2011

Damnit I went and edited mine too, going to post it reguardless

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/vr", true))
    {
        if(IsPlayerVipMember(playerid)) return SendClientMessage(playerid,red,"Only Vip's Can Repair Their Vehicles.");
        if(IsPlayerInAnyVehicle(playerid))
        {
            new vehicleid = GetPlayerVehicleID(playerid);
            SetVehicleHealth(vehicleid,1000.0);
            SendClientMessage(playerid,Green1, "Vehicle fixed.");
        }
        else
        {
            SendClientMessage(playerid,red, "You are not in a vehicle!");
        }
    }
    return 1;
}



Re: [help] Commands Not Working - mastalol - 17.07.2011

Quote:
Originally Posted by lolumadd_
Посмотреть сообщение
^That wont work. Mine is corrected:

Код:
    if(strcmp(cmdtext, "/vr", true) == 0) 
          {
        if(!IsPlayerVipMember(playerid)) return SendClientMessage(playerid,red,"Only Vip's Can Repair Their Vehicles.");
        else
        {
            if(IsPlayerInAnyVehicle(playerid)) 
           {
                new vehicleid = GetPlayerVehicleID(playerid);
                SetVehicleHealth(vehicleid,1000.0);
                SendClientMessage(playerid,Green1, "Vehicle fixed.");
            }
            else 
       {
                SendClientMessage(playerid,red, "You are not in a vehicle!");
            }

        }
    }
    return 1;
}
Try that
Thanks You Also Answered my other question before i got to ask it.....
btw how can i make
Код:
    if(strcmp(cmdtext, "/vr", true) == 0) 
          {
        if(!IsPlayerVipMember(playerid)) return SendClientMessage(playerid,red,"Only Vip's Can Repair Their Vehicles.");
        else
        {
            if(IsPlayerInAnyVehicle(playerid)) 
           {
                new vehicleid = GetPlayerVehicleID(playerid);
                SetVehicleHealth(vehicleid,1000.0);
                SendClientMessage(playerid,Green1, "Vehicle fixed.");
            }
            else 
       {
                SendClientMessage(playerid,red, "You are not in a vehicle!");
            }

        }
    }
    return 1;
}
Work for admins only
Admin check=
Код:
if (IsPlayerLuxAdm(playerid))