Problem with command
#1

pawn Код:
if(strcmp(cmd,"/Carhelp",true)==0)
    {
    tmp=strtok(cmdtext,idx);
    if(!strlen(tmp))  return SendClientMessage(playerid,0xFFFFFFFF,"Usage : /Carhelp [1-3]");
    if(strcmp(tmp,"1",true))
    {
        SendClientMessage(playerid,0x0099FFFF,"-------- [Vehicle/Car System!] --------");
        SendClientMessage(playerid,0x00FF00FF,"/Car - Information about a vehicle.");
        SendClientMessage(playerid,0x00FF00FF,"/Cars - Information with Statistics about the server vehicles.");
        SendClientMessage(playerid,0x00FF00FF,"/Buycar - To buy a vehicle.");
        SendClientMessage(playerid,0x00FF00FF,"/Sellcar - To sell your own vehicle.");
        SendClientMessage(playerid,0x00FF00FF,"/Callcar - To call your vehicle to your currect position.");
        SendClientMessage(playerid,0x0099FFFF,"-------- [Carhelp Page 1] --------");
    }
    if(strcmp(tmp,"2",true))
    {
        SendClientMessage(playerid,0x0099FFFF,"-------- [Vehicle/Car System!] --------");
        SendClientMessage(playerid,0x00FF00FF,"/Watch[Car/off] - To spectate your vehicle.");
        SendClientMessage(playerid,0x00FF00FF,"/[Un]lock - To lock/unlock your vehicle.");
        SendClientMessage(playerid,0x00FF00FF,"/Resetcar - To reset your vehicle to his parking lot.");
        SendClientMessage(playerid,0x00FF00FF,"/Eject[All] - To eject a player from your vehicle.");
        SendClientMessage(playerid,0x0099FFFF,"-------- [Carhelp Page 2] --------");
    }
    return 1;
}
    return 0;
}
When a player typing /Carhelp it's saying that line again and again '"Usage /Carhelp [1-3]".
How can i fix that? I tried everything..
Reply
#2

It would be easyer to use sscanf but try.
pawn Код:
if(strlen(tmp) == 0)
Reply
#3

Quote:
Originally Posted by HDFord
Посмотреть сообщение
It would be easyer to use sscanf but try.
pawn Код:
if(strlen(tmp) == 0)
Still saying the Usage line..
Here's the new line after what you told me to change

pawn Код:
if(strlen(tmp) == 0)  return SendClientMessage(playerid,0xFFFFFFFF,"Usage : /Carhelp [1-3]");
Reply
#4

Why don't you use ZCMD and sscanf? It's way simpler and easier!
Reply
#5

Quote:
Originally Posted by Gangs_Rocks
Посмотреть сообщение
Why don't you use ZCMD and sscanf? It's way simpler and easier!
Well i'm not a good friend of zCMD, can you please help me?
Reply
#6

I dont use strcmp much but then blow the hole strlen and do this.
pawn Код:
if(!strcmp(tmp,"1",true)) return // usage
else
{
//code
}
Reply
#7

Why don't you make a dialog or textdraw? Having lots of text in chat is stupid because it goes off the screen!
Reply
#8

PHP код:
ShowPlayerDialog(playerid,100,DIALOG_STYLE_MSGBOX,"Vehicle/Car System","/car - Information about a vehicle\n/cars -Information with statisctics about the server vehicles\n/buycar - buy a vehicle\n/sellcar - Sell your car\n/callcar - call your car","Ok",""); 
Try this, but i recommend you to use Zcmd processor
Reply
#9

Quote:
Originally Posted by Ken97
Посмотреть сообщение
PHP код:
ShowPlayerDialog(playerid,100,DIALOG_STYLE_MSGBOX,"Vehicle/Car System","/car - Information about a vehicle\n/cars -Information with statisctics about the server vehicles\n/buycar - buy a vehicle\n/sellcar - Sell your car\n/callcar - call your car","Ok",""); 
Try this, but i recommend you to use Zcmd processor
Good idea, but it will disable the "USAGE : /Carhelp [1-3]" message?
Reply
#10

Yes it does, But i made a new one, Instead of using /carhelp[1-3] , you can just use one command, /carhelp to show all this commands

Here ya go
PHP код:
new part1[] = "\n/car - Info about your vehicle\n/cars - Statistics about the server vehicles\n/buycar - Buy a vehicle\n/sellcar - to sell your vehicle\n/callcar - call your vehicle";
new 
part2[] = "\n/watch[car/off] - to spectate your vehicle\n/[Un]lock - To lock/unlock your vehicle\n/resetcar - to reset your vehicle to the parked position\n/eject[all] - To eject a player from your vehicle";
new 
string[128];
format(stringsizeof(string),"%s %s",part1,part2);
ShowPlayerDialog(playerid100DIALOG_STYLE_MSGBOX,"Vehicle Car System",string,"Done",""); 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)