[Help] Two commands malfuntioning
#1

Hello,

I am very tired so I can't really think right so I was wondering if you guys could just do me a favor and tell me whats wrong with a few of my cmds. They are below!



if(strcmp(cmd, "/chi", true) == 0 || strcmp(cmd, "/chinese", true) == 0) // By Blade
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREY, " You havent logged in yet !");
return 1;
}
if(PlayerInfo[playerid][pLeader] == 34 || PlayerInfo[playerid][pMember] == 34)
{
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/chi)nese [chat]");
return 1;
}
new Float, Float:y, Float:z;
GetPlayerPos(playerid,x,y,z);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pMember] == 34 || PlayerInfo[i][pLeader] == 34)
{
format(string, sizeof(string), "%s Says: [Chinese] %s", sendername, result);
SendClientMessage(i, COLOR_FADE3, string);
}
else
{
format(string, sizeof(string), "%s Says: [Unknown language]", sendername);
SendClientMessage(i, COLOR_FADE3, string);
}
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You can't speak Japanese !");
}
}
return 1;
}


Here is the second one.



if(strcmp(cmd, "/checkbelt", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, "USAGE: /checkbelt [playerid]");
return 1;
}
new playa;
if(strlen(tmp))
{
playa = ReturnUser(tmp);
}
else
{
playa = strval(tmp);
}
if(GetPlayerState(playa) == PLAYER_STATE_ONFOOT)
{
SendClientMessage(playerid,COLOR_GREY,"The player is not in any vehicle");
return 1;
}
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
if (PlayerInfo[playerid][pMember] != 1 && PlayerInfo[playerid][pLeader] != 1 && PlayerInfo[playerid][pMember] != 2 && PlayerInfo[playerid][pLeader] != 2)
{
SendClientMessage(playerid,COLOR_GREY,"You are not a cop");
return 1;
}
if (ProxDetectorS(9.0, playerid, giveplayerid))
{
new stext[255];
if(PlayerInfo[playa][pSeatBelt] == 0) { stext = "Off"; }
else if(PlayerInfo[playa][pSeatBelt] == 1) { stext = "On"; }
format(string, sizeof(string), "%s's seat belt is currently %s" , giveplayer , stext);
SendClientMessage(playerid,COLOR_WHITE,string);
new string2[255];
format(string2, sizeof(string2), "* %s has checked %s for wearing a selt belt.", sendername ,giveplayer);
ProxDetector(30.0, playerid, string2, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
}
else
{
SendClientMessage(playerid, COLOR_GREY, "you are not around that player!")
}
return 1;
}



I am too tired or I would have probably fixed this my self but I need it done tonight. Please help.


Note: the highlighted notes are what is appearing instead of the command doing its function.
Reply
#2

first try using

[ pawn ] Your pawn codes here [ /pawn ]

second try doing this

pawn Код:
return SendClientMessage(playerid, COLOR_GREY, "You can't speak Japanese !");
pawn Код:
return SendClientMessage(playerid, COLOR_GREY, "you are not around that player!")
i have my doubt about it working but it is just a suggestion give it a try
Reply
#3

There is a reason I didnt do the pawn code and thats so the highlight works. Also, I know that doesnt work becuase I have tried it
Reply
#4

Does anyone else have any clue what to do?
Reply
#5

Could someone help with this?
Reply
#6

I really don't see a problem in this script. What is it supposed to do and what does it do instead?
Reply
#7

Read the first post! -_-
Reply
#8

Quote:

Note: the highlighted notes are what is appearing instead of the command doing its function.

I still don't get it. Does it give you errors about those lines when you're trying to compile it?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)