08.07.2009, 06:05
This may or may not work. If it does not, then you must post your entire OnPlayerCommandText function.
The problem is that you returned a value before "/login" and "/register" can be identified by strcmp.
When you return a value, it basically tells your function to stop what it's doing and exit.
So that makes the code below the "return 0;" (line 822 in the OnPlayerCommandText function unreachable.
Simply erasing the "return 0;" at the end of your posted code should solve the problem.
The problem is that you returned a value before "/login" and "/register" can be identified by strcmp.
When you return a value, it basically tells your function to stop what it's doing and exit.
So that makes the code below the "return 0;" (line 822 in the OnPlayerCommandText function unreachable.
Simply erasing the "return 0;" at the end of your posted code should solve the problem.
pawn Код:
//---------------------------<[ OnPlayerCommandText ]>--------------------------------------------------------
new AmmountOfCones;
enum PlayerCones {
Cone1,
Cone2,
Cone3,
Cone4,
Cones
}
new PlayerConeCounter[MAX_PLAYERS][PlayerCones];
public OnPlayerCommandText(playerid, cmdtext[]) {
if ( !strcmp(cmdtext, "/Cone", true) ) {
if ( AmmountOfCones == MAX_CONES ) return SendClientMessage(playerid, COLOR_RED, "((Server Cone Limit Reached))");
if ( PlayerConeCounter[playerid][Cones] == MAX_PLAYER_CONES ) return SendClientMessage(playerid, COLOR_RED, "You have no more cones");
new Float:X, Float:Y, Float:Z, Float:A;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, A);
if ( PlayerConeCounter[playerid][Cone1] == 0 ) {
PlayerConeCounter[playerid][Cone1] = CreateObject(1238, X, Y, Z-0.7, 0.0, 0.0, A);
AmmountOfCones++;
PlayerConeCounter[playerid][Cones] += 1;
} else {
if ( PlayerConeCounter[playerid][Cone2] == 0 ) {
PlayerConeCounter[playerid][Cone2] = CreateObject(1238, X, Y, Z-0.7, 0.0, 0.0, A);
AmmountOfCones++;
PlayerConeCounter[playerid][Cones] += 1;
} else {
if ( PlayerConeCounter[playerid][Cone3] == 0 ) {
PlayerConeCounter[playerid][Cone3] = CreateObject(1238, X, Y, Z-0.7, 0.0, 0.0, A);
AmmountOfCones++;
PlayerConeCounter[playerid][Cones] += 1;
} else {
if ( PlayerConeCounter[playerid][Cone4] == 0 ) {
PlayerConeCounter[playerid][Cone4] = CreateObject(1238, X, Y, Z-0.7, 0.0, 0.0, A);
AmmountOfCones++;
PlayerConeCounter[playerid][Cones] += 1;
}
}
}
}
SetPlayerPos(playerid, X, Y, Z);
return SendClientMessage(playerid, COLOR_GREEN, "You have placed a cone.");
}
if ( !strcmp(cmdtext, "/RemoveCones", true) ) {
for ( new i = 0; i <= PlayerConeCounter[playerid][Cones]; i++ ) {
if ( PlayerConeCounter[playerid][Cones] == 1 ) {
DestroyObject(PlayerConeCounter[playerid][Cone1]);
AmmountOfCones -= 1;
} else if ( PlayerConeCounter[playerid][Cones] == 2 ) {
DestroyObject(PlayerConeCounter[playerid][Cone1]);
DestroyObject(PlayerConeCounter[playerid][Cone2]);
AmmountOfCones -= 2;
} else if ( PlayerConeCounter[playerid][Cones] == 3 ) {
DestroyObject(PlayerConeCounter[playerid][Cone1]);
DestroyObject(PlayerConeCounter[playerid][Cone2]);
DestroyObject(PlayerConeCounter[playerid][Cone3]);
AmmountOfCones -= 3;
} else if ( PlayerConeCounter[playerid][Cones] == 4 ) {
DestroyObject(PlayerConeCounter[playerid][Cone1]);
DestroyObject(PlayerConeCounter[playerid][Cone2]);
DestroyObject(PlayerConeCounter[playerid][Cone3]);
DestroyObject(PlayerConeCounter[playerid][Cone4]);
AmmountOfCones -= 4;
}
PlayerConeCounter[playerid][Cone1] = 0;
PlayerConeCounter[playerid][Cone2] = 0;
PlayerConeCounter[playerid][Cone3] = 0;
PlayerConeCounter[playerid][Cone4] = 0;
PlayerConeCounter[playerid][Cones] = 0;
}
return SendClientMessage(playerid, COLOR_GREEN, "You have picked your cones up.");
}
if ( !strcmp(cmdtext, "/RemoveConesAll", true) ) {
if ( IsPlayerAdmin(playerid) ) {
for ( new i = 0; i <= MAX_PLAYERS; i++ ) {
DestroyObject(PlayerConeCounter[playerid][Cone1]);
DestroyObject(PlayerConeCounter[playerid][Cone2]);
DestroyObject(PlayerConeCounter[playerid][Cone3]);
DestroyObject(PlayerConeCounter[playerid][Cone4]);
PlayerConeCounter[playerid][Cone1] = 0;
PlayerConeCounter[playerid][Cone2] = 0;
PlayerConeCounter[playerid][Cone3] = 0;
PlayerConeCounter[playerid][Cone4] = 0;
PlayerConeCounter[playerid][Cones] = 0;
AmmountOfCones = 0;
}
return SendClientMessage(playerid, COLOR_GREEN, "*ADMIN*- You have removed all the cones.");
}
}
new string[256];
new playermoney;
new sendername[MAX_PLAYER_NAME];
new giveplayer[MAX_PLAYER_NAME];
new playername[MAX_PLAYER_NAME];
new cmd[256];
new tmp[256];
new giveplayerid, moneys, idx;
cmd = strtok(cmdtext, idx);