24.11.2011, 10:30
I have multiplie commands under OnPlayerCommanText using strcmp but it shows Server - Unknows Command if i enter the server, it's somehow like OnPlayerCOmmandText doesnt exist, how to fix it?
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[128], idx;
cmd = strtok(cmdtext, idx);
if(!strcmp(cmdtext, "/hauskaufen", true))
{
if(HouseOwner[playerid] == false)
{
if(IsSettingUpHouse[playerid] == false)
{
ShowPlayerDialog(playerid, 17, DIALOG_STYLE_MSGBOX, "Bestдtigung", "Du bist dabei ein Haus zu kaufen.\n\nKlicke auf 'Weiter' um fortzufahren.", "Weiter", "Abbrechen");
}
else
{
SendClientMessage(playerid, COLOR_RED, "Du kaufst bereits ein Haus!");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "Du besitzt bereits ein Haus!");
return 1;
}
return 1;
}
if(!strcmp(cmdtext, "/erweitern", true))
{
if(HouseOwner[playerid] == true)
{
ShowPlayerDialog(playerid, 29, DIALOG_STYLE_LIST, "Hauserweiterung", "Name дndern\nBeschreibung дndern\nEingang дndern\nInterieur wechseln\nMietinfo дndern", "Auswдhlen", "Abbrechen");
return 1;
}
else
{
SendClientMessage(playerid, COLOR_RED, "Du besitzt kein Haus!");
}
return 1;
}
if(!strcmp(cmdtext, "/bestatigen", true))
{
if(SettingUpEntrance[playerid] == true)
{
new str[32], str2[32], str3[32];
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
SetupHouseInfo[playerid][SetupPX] = X;
SetupHouseInfo[playerid][SetupPY] = Y;
SetupHouseInfo[playerid][SetupPZ] = Z;
HousePickup[playerid] = CreatePickup(1273, 23, X, Y, Z);
PlayerPlaySound(playerid, 1149, 0.0, 0.0, 0.0);
SendClientMessage(playerid, COLOR_GREEN, "Koordinaten:");
format(str, sizeof(str), "X: %f", X);
SendClientMessage(playerid, 0xFFFFFFAA, str);
format(str2, sizeof(str2), "Y: %f", Y);
SendClientMessage(playerid, 0xFFFFFFAA, str2);
format(str3, sizeof(str3), "Z: %f", Z);
SendClientMessage(playerid, 0xFFFFFFAA, str3);
ShowPlayerDialog(playerid, 18, DIALOG_STYLE_LIST, "Haus", "Eingang\nName\nBeschreibung\nInterieur\nMiete\nKaufen", "Auswдhlen", "Abbrechen");
HasAlreadySetupEntrance[playerid] = true;
return 1;
}
return 1;
}
if(!strcmp(cmdtext, "/sperren", true))
{
for(new h = 0; h < sizeof(HouseInfo); h++)
{
if(HouseOwner[playerid] == true)
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, HouseInfo[h][PX], HouseInfo[h][PY], HouseInfo[h][PZ]))
{
if(HouseInfo[h][Locked] == 0)
{
HouseInfo[h][Locked] = 1;
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
GameTextForPlayer(playerid, "~r~Haus gesperrt!", 5000, 6);
return 1;
}
else if(HouseInfo[h][Locked] == 1)
{
HouseInfo[h][Locked] = 0;
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
GameTextForPlayer(playerid, "~g~Haus ist offen!", 5000, 6);
return 1;
}
else if(!IsPlayerInRangeOfPoint(playerid, 3.0, HouseInfo[h][PX], HouseInfo[h][PY], HouseInfo[h][PZ]))
{
SendClientMessage(playerid, COLOR_RED, "Du bist nicht in der Nдhe deines Hauses!");
return 1;
}
}
else if(HouseOwner[playerid] == false)
{
SendClientMessage(playerid, COLOR_RED, "Du besitzt kein Haus!");
return 1;
}
}
}
return 1;
}
if(!strcmp(cmdtext, "/enter", true))
{
for(new h = 0; h < sizeof(HouseInfo); h++)
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, HouseInfo[h][PX], HouseInfo[h][PY], HouseInfo[h][PZ]))
{
if(HouseInfo[h][Locked] == 0 || IsRentingHouse[playerid] == true)
{
SetPlayerPos(playerid, HouseInfo[h][TX], HouseInfo[h][TY], HouseInfo[h][TZ]);
SetPlayerFacingAngle(playerid, HouseInfo[h][TA]);
SetPlayerInterior(playerid, HouseInfo[h][Int]);
SetPlayerVirtualWorld(playerid, HouseInfo[h][Vir]);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Dieses Haus ist gesperrt.");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "Du bist nicht in der Nдhe eines Hauses!");
return 1;
}
}
return 1;
}
if(!strcmp(cmdtext, "/exit", true))
{
for(new h = 0; h < sizeof(HouseInfo); h++)
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, HouseInfo[h][TX], HouseInfo[h][TY], HouseInfo[h][TZ]))
{
SetPlayerPos(playerid, HouseInfo[h][PX], HouseInfo[h][PY], HouseInfo[h][PZ]);
SetPlayerFacingAngle(playerid, 0.0);
SetPlayerInterior(playerid, 0);
SetPlayerVirtualWorld(playerid, 0);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_RED, "Du bist nicht in einem Haus!");
return 1;
}
}
return 1;
}
if(!strcmp(cmdtext, "/hverkaufen", true))
{
for(new h = 0; h < sizeof(HouseInfo); h++)
{
if(HouseOwner[playerid] == true)
{
new str[64];
format(str, sizeof(str), "Glьckwunsch! Du hast dein Haus fьr $%i verkauft.",HouseInfo[h][Price]/2);
SendClientMessage(playerid, COLOR_GREEN, str);
GivePlayerMoney(playerid, HouseInfo[h][Price]/2);
HouseOwner[playerid] = false;
HouseInfo[h][Name] = 0;
HouseInfo[h][Desc] = 0;
HouseInfo[h][Owner] = 0;
HouseInfo[h][Price] = 0;
HouseInfo[h][PX] = 0.0;
HouseInfo[h][PY] = 0.0;
HouseInfo[h][PZ] = 0.0;
HouseInfo[h][TX] = 0.0;
HouseInfo[h][TY] = 0.0;
HouseInfo[h][TZ] = 0.0;
HouseInfo[h][TA] = 0.0;
HouseInfo[h][Int] = 0;
HouseInfo[h][Vir] = 0;
DestroyPickup(HousePickup[playerid]);
Delete3DTextLabel(HouseLabel[playerid]);
new file[100], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, 24);
format(file, sizeof(file), "austria/hauser/%s.ini", pName);
dini_Remove(file);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_RED, "Du besitzt kein Haus!");
return 1;
}
}
return 1;
}
if(!strcmp(cmdtext, "/cashsafe", true))
{
for(new h = 0; h < sizeof(HouseInfo); h++)
{
if(HouseOwner[playerid] == true)
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, HouseInfo[h][TX], HouseInfo[h][TY], HouseInfo[h][TZ]))
{
ShowPlayerDialog(playerid, 24, DIALOG_STYLE_INPUT, "Safe", "Wieviel Geld willst du im Safe geben?", "OK", "Abbrechen");
return 1;
}
else
{
SendClientMessage(playerid, COLOR_RED, "Du bist nicht in deinem Haus!");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "Du besitzt kein Haus!");
return 1;
}
}
return 1;
}
if(!strcmp(cmdtext, "/nehmen", true))
{
for(new h = 0; h < sizeof(HouseInfo); h++)
{
if(HouseOwner[playerid] == true)
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, HouseInfo[h][TX], HouseInfo[h][TY], HouseInfo[h][TZ]))
{
ShowPlayerDialog(playerid, 25, DIALOG_STYLE_INPUT, "Safe", "Wieviel Geld willst du aus dem Safe nehmen?", "OK", "Abbrechen");
return 1;
}
else
{
SendClientMessage(playerid, COLOR_RED, "Du bist nicht in deinem Haus!");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "Du besitzt kein Haus!");
return 1;
}
}
return 1;
}
if(!strcmp(cmdtext, "/mieten", true))
{
for(new h = 0; h < sizeof(HouseInfo); h++)
{
if(HouseOwner[playerid] == false)
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, HouseInfo[h][TX], HouseInfo[h][TY], HouseInfo[h][TZ]))
{
if(HouseInfo[h][Rentable] == 1)
{
if(IsRentingHouse[playerid] == false)
{
new string[64];
format(string, sizeof(string), "Bist du dir sicher dass du in dieses Haus einmieten willst? Preis: $%i?", HouseInfo[h][RentPrice]);
ShowPlayerDialog(playerid, 26, DIALOG_STYLE_MSGBOX, "Bestдtigung", string, "Ja", "Nein");
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Du mietes bereits ein Haus.");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "Dieses Haus kann nicht gemietet werden!");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "Du bist nicht in der Nдhe eines Hauses!");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "Du kannst nicht ein Haus mieten wenn du bereits ein eigenes besitzt!");
return 1;
}
}
return 1;
}
if(!strcmp(cmdtext, "/mietebeenden", true))
{
for(new h = 0; h < sizeof(HouseInfo); h++)
{
if(IsRentingHouse[playerid] == true)
{
SendClientMessage(playerid, COLOR_YELLOW, "Du mietest das Haus nicht mehr, du bist nun obdachlost.");
IsRentingHouse[playerid] = false;
return 1;
}
else
{
SendClientMessage(playerid, COLOR_RED, "Du mietest kein Haus!");
return 1;
}
}
return 1;
}
if(strcmp(cmd, "/hausakzeptieren", true) == 0)
{
if(PlayerInfo[playerid][pAdmin] < 2) return SCM(playerid, COLOR_RED,"Du hast nicht die nцtigen Rechte dazu.");
new tmp[128], giveplayerid;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_GREY, "Nutzung: /hausakzeptieren [spielerid/teildesnamens]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid)) {
if(giveplayerid != INVALID_PLAYER_ID) {
if(IsApprovalPending[giveplayerid] == true) {
new money = GetPlayerMoney(giveplayerid);
if(money < SetupHouseInfo[giveplayerid][SetupPrice])
{
SendClientMessage(giveplayerid, COLOR_RED, "Du kannst dir dieses Haus nicht leisten!");
IsSettingUpHouse[giveplayerid] = false; SettingUpEntrance[giveplayerid] = false;
HasAlreadySetupName[giveplayerid] = false; HasAlreadySetupDesc[giveplayerid] = false;
HasAlreadySetupEntrance[giveplayerid] = false; HasAlreadySetupInterior[giveplayerid] = false;
HasAlreadySetupRentable[giveplayerid] = false; HasAlreadySetupRentPrice[giveplayerid] = false;
SetupHouseInfo[giveplayerid][SetupName] = 0; SetupHouseInfo[giveplayerid][SetupDesc] = 0;
SetupHouseInfo[giveplayerid][SetupOwner] = 0; SetupHouseInfo[giveplayerid][SetupPrice] = 0;
SetupHouseInfo[giveplayerid][SetupPX] = 0.0; SetupHouseInfo[giveplayerid][SetupPY] = 0.0;
SetupHouseInfo[giveplayerid][SetupPZ] = 0.0; SetupHouseInfo[giveplayerid][SetupTX] = 0.0;
SetupHouseInfo[giveplayerid][SetupTY] = 0.0; SetupHouseInfo[giveplayerid][SetupTZ] = 0.0;
SetupHouseInfo[giveplayerid][SetupTA] = 0.0; SetupHouseInfo[giveplayerid][SetupInt] = 0;
SetupHouseInfo[giveplayerid][SetupVir] = 0; SetupHouseInfo[giveplayerid][SetupRentable] = 0;
SetupHouseInfo[giveplayerid][SetupRentPrice] = 0;
DestroyPickup(HousePickup[playerid]);
Delete3DTextLabel(HouseLabel[playerid]);
IsApprovalPending[giveplayerid] = false;
PlayerPlaySound(giveplayerid, 1085, 0.0, 0.0, 0.0);
new file[100], pname[24];
GetPlayerName(giveplayerid, pname, 24);
format(file, sizeof(file), "austria/hauser/%s.ini", pname);
dini_Remove(file);
return 1;
}
else {
new str[64];
for(new h = 0; h < sizeof(HouseInfo); h++)
{
new str2[128];
HouseInfo[h][Name] = SetupHouseInfo[giveplayerid][SetupName];
HouseInfo[h][Desc] = SetupHouseInfo[giveplayerid][SetupDesc];
HouseInfo[h][Owner] = SetupHouseInfo[giveplayerid][SetupOwner];
HouseInfo[h][Price] = SetupHouseInfo[giveplayerid][SetupPrice];
HouseInfo[h][PX] = SetupHouseInfo[giveplayerid][SetupPX];
HouseInfo[h][PY] = SetupHouseInfo[giveplayerid][SetupPY];
HouseInfo[h][PZ] = SetupHouseInfo[giveplayerid][SetupPZ];
HouseInfo[h][TX] = SetupHouseInfo[giveplayerid][SetupTX];
HouseInfo[h][TY] = SetupHouseInfo[giveplayerid][SetupTY];
HouseInfo[h][TZ] = SetupHouseInfo[giveplayerid][SetupTZ];
HouseInfo[h][TA] = SetupHouseInfo[giveplayerid][SetupTA];
HouseInfo[h][Int] = SetupHouseInfo[giveplayerid][SetupInt];
HouseInfo[h][Vir] = SetupHouseInfo[giveplayerid][SetupVir];
HouseInfo[h][Locked] = 0;
HouseInfo[h][Rentable] = SetupHouseInfo[giveplayerid][SetupRentable];
HouseInfo[h][RentPrice] = SetupHouseInfo[giveplayerid][SetupRentPrice];
PlayerPlaySound(giveplayerid, 1149, 0.0, 0.0, 0.0);
format(str, sizeof(str), "Glьckwunsch! Du hast ein Haus fьr $%i gekauft.", SetupHouseInfo[giveplayerid][SetupPrice]);
SendClientMessage(giveplayerid, COLOR_YELLOW, str);
GivePlayerMoney(giveplayerid, -HouseInfo[h][Price]);
HouseOwner[giveplayerid] = true;
IsSettingUpHouse[giveplayerid] = false; SettingUpEntrance[giveplayerid] = false;
HasAlreadySetupName[giveplayerid] = false; HasAlreadySetupDesc[giveplayerid] = false;
HasAlreadySetupEntrance[giveplayerid] = false; HasAlreadySetupInterior[giveplayerid] = false;
SetupHouseInfo[giveplayerid][SetupName] = 0; SetupHouseInfo[giveplayerid][SetupDesc] = 0;
SetupHouseInfo[giveplayerid][SetupOwner] = 0; SetupHouseInfo[giveplayerid][SetupPrice] = 0;
SetupHouseInfo[giveplayerid][SetupPX] = 0.0; SetupHouseInfo[giveplayerid][SetupPY] = 0.0;
SetupHouseInfo[giveplayerid][SetupPZ] = 0.0; SetupHouseInfo[giveplayerid][SetupTX] = 0.0;
SetupHouseInfo[giveplayerid][SetupTY] = 0.0; SetupHouseInfo[giveplayerid][SetupTZ] = 0.0;
SetupHouseInfo[giveplayerid][SetupTA] = 0.0; SetupHouseInfo[giveplayerid][SetupInt] = 0;
SetupHouseInfo[giveplayerid][SetupVir] = 0; HasAlreadySetupRentable[giveplayerid] = false;
SetupHouseInfo[giveplayerid][SetupRentable] = 0; SetupHouseInfo[giveplayerid][SetupRentable] = 0;
SetupHouseInfo[giveplayerid][SetupRentPrice] = 0;
HasAlreadySetupRentPrice[giveplayerid] = false;
IsApprovalPending[giveplayerid] = false;
new pname[MAX_PLAYER_NAME];
new name[256], desc[256];
new file[100];
GetPlayerName(giveplayerid, pname, sizeof(pname));
format(file, sizeof(file), "austria/hauser/%s.ini", pname);
name = dini_Get(file, "Name");
desc = dini_Get(file, "Beschreibung");
format(str2, sizeof(str2), "Name: %s\n\nBeschreibung: %s\n\nBesitzer: %s", name, desc, pname);
HouseLabel[giveplayerid] = Create3DTextLabel(str2, COLOR_LIGHTBLUE, HouseInfo[h][PX], HouseInfo[h][PY], HouseInfo[h][PZ], 20.0, 0);
return 1;
}
}
}
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "Dieser Spieler hat noch kein Haus erstellt!");
}
return 1;
}
if(strcmp(cmd, "/hausablehnen", true) == 0)
{
if(PlayerInfo[playerid][pAdmin] < 2) return SCM(playerid, COLOR_RED,"Du hast nicht die nцtigen Rechte dazu.");
new tmp[128], giveplayerid;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_GREY, "Nutzung: /hausablehnen [spielerid/teildesnamens]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid)) {
if(giveplayerid != INVALID_PLAYER_ID) {
if(IsApprovalPending[giveplayerid] == true) {
SendClientMessage(giveplayerid, COLOR_RED, "Dein Haus wurde abgelehnt weil es mцglicherweise am falschen Ort war.");
IsSettingUpHouse[giveplayerid] = false; SettingUpEntrance[giveplayerid] = false;
HasAlreadySetupName[giveplayerid] = false; HasAlreadySetupDesc[giveplayerid] = false;
HasAlreadySetupEntrance[giveplayerid] = false; HasAlreadySetupInterior[giveplayerid] = false;
SetupHouseInfo[giveplayerid][SetupName] = 0; SetupHouseInfo[giveplayerid][SetupDesc] = 0;
SetupHouseInfo[giveplayerid][SetupOwner] = 0; SetupHouseInfo[giveplayerid][SetupPrice] = 0;
SetupHouseInfo[giveplayerid][SetupPX] = 0.0; SetupHouseInfo[giveplayerid][SetupPY] = 0.0;
SetupHouseInfo[giveplayerid][SetupPZ] = 0.0; SetupHouseInfo[giveplayerid][SetupTX] = 0.0;
SetupHouseInfo[giveplayerid][SetupTY] = 0.0; SetupHouseInfo[giveplayerid][SetupTZ] = 0.0;
SetupHouseInfo[giveplayerid][SetupTA] = 0.0; SetupHouseInfo[giveplayerid][SetupInt] = 0;
SetupHouseInfo[giveplayerid][SetupVir] = 0; SetupHouseInfo[giveplayerid][SetupRentable] = 0;
SetupHouseInfo[giveplayerid][SetupRentPrice] = 0;
IsApprovalPending[giveplayerid] = false;
DestroyPickup(HousePickup[giveplayerid]);
Delete3DTextLabel(HouseLabel[giveplayerid]);
PlayerPlaySound(giveplayerid, 1085, 0.0, 0.0, 0.0);
new file[100], pname[24];
GetPlayerName(giveplayerid, pname, 24);
format(file, sizeof(file), "austria/hauser/%s.ini", pname);
dini_Remove(file);
return 1;
}
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "Dieser Spieler hat noch kein Haus erstellt!");
}
return 1;
}
return 1;
}