Can someone help me with this?
#1

Hello all
Im trying to make a new FS but every time I load it in to my server and go in game and type a cmd like /help its just says: You are not a admin. If i do login as RCON admin and still types /help it says: You are not in a vehicle.
I did found out that it was this commad in my new FS that's doing it:
pawn Код:
if(strcmp(cmd, "/arentcar", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, red, "USAGE: /arentcar [price]");
return 1;
}
new rentprice = strval(tmp);
if (IsPlayerAdmin(playerid))
{
if(IsPlayerInAnyVehicle(playerid))
{
if(rentprice >= 1 && rentprice <=9999)
{
new car = GetPlayerVehicleID(playerid) - 1;
new vehicleid = GetPlayerVehicleID(playerid);
RentCars[car][Price] = rentprice;
new wstring[128];
format(wstring, sizeof(wstring), "You've have now set this %d for rent with the price %d.", vehicleid,rentprice);
SendClientMessage(playerid,red, wstring);
SaveDynamicCars();
}
else
{
SendClientMessage(playerid, red, "Incorrect Price, Price Can Only Be 1-9999.");
}
}
else
{
SendClientMessage(playerid, red, "Your not in a vehicle!");
}
}
else
{
SendClientMessage(playerid, red, "Your not an administrator.");
}
}
return 1;
}
1. Yes my OnPlayerCommandText returns 0 at my FS
2. Yes my OnPlayerCommandText returns 0 at my GM
3. Yes I have search a lot but I could not find anything
4. Yes I all my variables and public's is right
5. No I dont get any errors when I compile the script
Is there a way to fix this?
Reply
#2

You should try this:
pawn Код:
if(strcmp(cmd, "/arentcar", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, red, "USAGE: /arentcar [price]");
new rentprice = strval(tmp);
if (!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, red, "Your not an administrator.");
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, red, "Your not in a vehicle!");
if(rentprice < 1 && rentprice > 9999) return SendClientMessage(playerid, red, "Incorrect Price, Price Can Only Be 1-9999.");
new car = GetPlayerVehicleID(playerid) - 1;
new vehicleid = GetPlayerVehicleID(playerid);
RentCars[car][Price] = rentprice;
new wstring[128];
format(wstring, sizeof(wstring), "You've have now set this %d for rent with the price %d.", vehicleid,rentprice);
SendClientMessage(playerid,red, wstring);
SaveDynamicCars();
return 1;
}
Reply
#3

Sorry that did not work But your code gave me a new idea But I still need help with this
Reply
#4

And what is wrong with that again? :O
Reply
#5

Every time I load the FS in to my server and go in game and type a cmd like /help its just says: You are not a admin. If I do login as RCON admin and still types /help it says: You are not in a vehicle.
Thats the problem :P
Reply
#6

So go to some vehicle!
Reply
#7

But I dont want to be in a vehicle to type /help or /stats those commands are in my GM and they work when I take away this command I need help with from my new FS :P
Reply
#8

I don't know then. Show me your FS as it is please. I am a bit confused.
Reply
#9

Well now I did turn it into a DCMD and the cmd almost works Its just dont save
pawn Код:
dcmd_arentcar(playerid, params[])
{
if(IsPlayerAdmin(playerid))
{
new rentprice;
if (sscanf(params, "d", rentprice)) SendClientMessage(playerid, red, "SERVER: /arentcar [price]");
else
{
if(rentprice > 9999 && rentprice < 1)
{
if(IsPlayerInAnyVehicle(playerid))
{
new car = GetPlayerVehicleID(playerid) - 1;
new vehicleid = GetPlayerVehicleID(playerid);
RentCars[car][Price] = rentprice;
new wstring[128];
format(wstring, sizeof(wstring), "You've have now set this %d for rent with the price %d.", vehicleid,rentprice);
SendClientMessage(playerid,GREEN, wstring);
SaveRentCars();
}
}
}
}
return 1;
}
I did try to debug the code but could not find the problem Anyone that could help me with the strcmp code or the DCMD code?
Reply
#10

Bump (more then 12 hrs )
Hope someone can help me whit this
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)