Hey, please help (probably simple)
#1

Hey!

Its my first time I make a server alone, I've already become better at scripting / editing and whatever but..
I got a problem probably simple, all I did this time was changing a command.
I took one letter out of it from /xlock to /lock, I removed the letter everywhere in the script using pwno and
changed the "commands" in my scriptfiles folder..

the thing is.. when I do /lock now it says unknown command.. wtf? all I did was changing the letter and when I compile my script I get no errors.. what could it be ?
please help me out!
Reply
#2

Just if this helps..

dcmd_lock(playerid,params[]) {
#pragma unused params
if(IsPlayerConnected(playerid,"lock")) {
if(IsPlayerInAnyVehicle(playerid)) {
for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i)) SetVehicleParamsForPlayer(GetPlayerVehicleID(playe rid),i,false,true);
new name[24]; VehicleLockData[GetPlayerVehicleID(playerid)] = true; GetPlayerName(playerid,name,24); SendClientMessage(playerid,yellow,"You have locked your car."); return 1;
} else return SendClientMessage(playerid,red,"ERROR: You must be in a vehicle to lock.");
} else return SendLevelErrorMessage(playerid,"lock");
}


dcmd_unlock(playerid,params[]) {
#pragma unused params
if(IsPlayerConnected(playerid,"unlock")) {
if(IsPlayerInAnyVehicle(playerid)) {
for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i)) SetVehicleParamsForPlayer(GetPlayerVehicleID(playe rid),i,false,false);
new name[24]; VehicleLockData[GetPlayerVehicleID(playerid)] = false; GetPlayerName(playerid,name,24); SendClientMessage(playerid,yellow,"You have unlocked your car."); return 1;
} else return SendClientMessage(playerid,red,"ERROR: You must be in a vehicle to unlock.");
} else return SendLevelErrorMessage(playerid,"unlock");
}

also I changed this at the top.


dcmd(lock,5,cmdtext);
dcmd(unlock,7,cmdtext);
Reply
#3

I can't understand anything from the codes as it is really bad organised...
Reply
#4

Why is there IsPlayerConnected(playerid, "/lock") ?

IsPlayerConnected has only 1 argument, the playerid.

Furthermore did you change

dcmd(xlock, 5, cmdtext);

to

dcmd(lock, 4, cmdtext);

(look at the numbers)
Reply
#5

Ohh I found the error, I changed it to clock and it worked.. I already had a /lock command so that probably confused it but thanks for your really fast responds!
Reply
#6

Quote:
Originally Posted by NaS
Посмотреть сообщение
Do you use strcmp inside OnPlayerCommandText?
if yes, it probably looks like this now:

if(strcmp(cmdtext, "/lock", true, 6) == 0)

but "/lock" is only 5 letters, so instead of 6 put a 5 in there.
Well I think you can see the commands over there that he's using DCMD and not the strcmp inside the OnPlayerCommandText.
Reply
#7

as using dcmd you must count how many letters are in the command. wait for my edit reply as ill fix your code too.

so your definition must be like this
pawn Код:
//parameter dcmd(yourcommandhere,numberofletterscommand,cmdtext);
dcmd(lock,4,cmdtext);
dcmd(unlock,6,cmdtext);
Reply
#8

Quote:
Originally Posted by Private200
Посмотреть сообщение
Well I think you can see the commands over there that he's using DCMD and not the strcmp inside the OnPlayerCommandText.
I know. I was typing the text while he was sending the second post.
Reply
#9

Quote:
Originally Posted by NaS
Посмотреть сообщение
Why is there IsPlayerConnected(playerid, "/lock") ?

IsPlayerConnected has only 1 argument, the playerid.

Furthermore did you change

dcmd(xlock, 5, cmdtext);

to

dcmd(lock, 4, cmdtext);

(look at the numbers)

Now I get it, thanks!

Still a noob but learning
Reply
#10

one more question though, I changed all that now but it gives me this

undefined symbol "dcmd_lock"
undefined symbol "dcmd_unlock"
number of arguments does not match definition

The last one is just a warning, I ran with that before aswell.. but what exactly does it mean with undefinded symbol? everything should be changed


Thanks for all your fast replays!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)