13.07.2010, 05:07
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.
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.