CMD:gused(playerid, params[])
{
new string[128];
if(!gPlayerLogged[playerid]) return SendClientMessage(playerid, COLOR_GREY, "To use the commands, you need to login first.");
if(PlayerInfo[playerid][pAdmin] < 6) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
SendClientMessage(playerid, COLOR_ORANGE, "[Used Gates]:");
for(new idx=1; idx<MAX_GATES; idx++)
{
if(GateInfo[idx][gModel])
{
format(string, sizeof(string), "ID: %d | Owner: %s | Object: %d | Speed: %f | Password: %s", idx, GateInfo[idx][gOwner], GateInfo[idx][gModel], GateInfo[idx][gSpeed], GateInfo[idx][gPassword]);
SendClientMessage(playerid, COLOR_ORANGE, string);
}
}
return 1;
}
CMD:makegateowner(playerid, params[])
{
new giveplayerid, slot, idx, string[128];
if(!gPlayerLogged[playerid]) return SendClientMessage(playerid, COLOR_GREY, "To use the commands, you need to login first.");
if(PlayerInfo[playerid][pAdmin] < 6) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command");
if(sscanf(params, "uii", playerid, slot, idx)) return SendClientMessage(playerid, COLOR_GREEN, "[+]{FFFFFF} /makegateowner [playerid] [slot(1-3)] [gateid]");
if(!gPlayerLogged[playerid]) return SendClientMessage(playerid, COLOR_GREY, "Suitable non-player ID si.");
if(idx > 0 && !GateInfo[idx][gModel] || idx < 0) return SendClientMessage(playerid, COLOR_GREY, "Invalid gate ID!");
if(slot < 1 || slot > 3) return SendClientMessage(playerid, COLOR_GREY, "Gate slots are between 1 and 3.");
switch(slot)
{
case 1: PlayerInfo[playerid][pGate1] = idx;
case 2: PlayerInfo[playerid][pGate2] = idx;
case 3: PlayerInfo[playerid][pGate3] = idx;
}
if(idx == 0)
{
format(string, sizeof(string), "%s admin %d to you deleted gate", GetPlayerNameEx(giveplayerid), slot);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "AdminWrong: %s admin %d to you deleted gate", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), slot);
SendAdminMessage(COLOR_LIGHTRED, 1, string);
Log("logs/gates.log", string);
}
else
{
format(string, sizeof(string), "%s admin %d ID for gate owner you!", GetPlayerNameEx(giveplayerid), idx, slot);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "AdminWrong: %s gate owned %s you ID! %d. (Slot %d)", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), idx, slot);
SaveGates();
SendAdminMessage(COLOR_LIGHTRED, 1, string);
Log("logs/gates.log", string);
}
return 1;
}
|
Can't understand turkish..
You can make it english version, Only to get help in forums |
|
You forgot to set GateInfo[idx][gOwner] to a playerid in your /makegateowner command.
|
enum gateInfo
{
gGate,
Text3D:gText,
gModel,
Float:gCX,
Float:gCY,
Float:gCZ,
Float:gCRX,
.
.
gOwner,
gStatus
}
format(string, sizeof(string), "ID: %d | Owner: %s | Object: %d | Speed: %f | Password: %s", idx, GateInfo[idx][gOwner], GateInfo[idx][gModel], GateInfo[idx][gSpeed], GateInfo[idx][gPassword]);
format(string, sizeof(string), "ID: %d | Owner: %d | Object: %d | Speed: %f | Password: %s", idx, GateInfo[idx][gOwner], GateInfo[idx][gModel], GateInfo[idx][gSpeed], GateInfo[idx][gPassword]);
if(GateInfo[idx][gOwner] != INVALID_PLAYER_ID) {
new ownerName[MAX_PLAYER_NAME + 1];
GetPlayerName(GateInfo[idx][gOwner], ownerName, sizeof(ownerName));
format(string, sizeof(string), "ID: %d | Owner: %s | Object: %d | Speed: %f | Password: %s", idx, ownerName, GateInfo[idx][gModel], GateInfo[idx][gSpeed], GateInfo[idx][gPassword]);
} else {
format(string, sizeof(string), "ID: %d | Owner: %s | Object: %d | Speed: %f | Password: %s", idx, "Nobody", GateInfo[idx][gModel], GateInfo[idx][gSpeed], GateInfo[idx][gPassword]);
}
GateInfo[idx][gOwner] = INVALID_PLAYER_ID;
|
Originally Posted by Freaksken
Код:
GateInfo[idx][gOwner] = INVALID_PLAYER_ID; |
CMD:gused(playerid, params[])
{
new string[128];
if(!gPlayerLogged[playerid]) return SendClientMessage(playerid, COLOR_GREY, "Komutları kullanmak iзin цnce giriş yapmanız gerekmektedir.");
if(PlayerInfo[playerid][pAdmin] < 6) return SendClientMessage(playerid, COLOR_GREY, "Bu komutu kullanma yetkiniz yok");
SendClientMessage(playerid, COLOR_ORANGE, "[Used Gates]:");
for(new idx=1; idx<MAX_GATES; idx++)
{
if(GateInfo[idx][gModel])
{
if(GateInfo[idx][gOwner] != INVALID_PLAYER_ID)
{
new ownerName[MAX_PLAYER_NAME + 1];
GetPlayerName(GateInfo[idx][gOwner], ownerName, sizeof(ownerName));
format(string, sizeof(string), "ID: %d | Owner: %s | Object: %d | Speed: %f | Password: %s", idx, ownerName, GateInfo[idx][gModel], GateInfo[idx][gSpeed], GateInfo[idx][gPassword]);
}
else
{
format(string, sizeof(string), "ID: %d | Owner: %s | Object: %d | Speed: %f | Password: %s", idx, "Nobody", GateInfo[idx][gModel], GateInfo[idx][gSpeed], GateInfo[idx][gPassword]);
}
SendClientMessage(playerid, COLOR_ORANGE, string);
}
}
return 1;
}
//Top of script
enum MY_ENUM {
SOME_KEY, //This will be initialized to 0
OTHER_KEY, //This will be initialized to 0
LAST_KEY //This will be initialized to 0
}
new myVariable[MY_ENUM];
//Somewhere in the script
printf("%d %d %d", myVariable[SOME_KEY], myVariable[OTHER_KEY], myVariable[LAST_KEY]);
GateInfo[idx][gOwner] = 0;
GateInfo[idx][gOwner] = INVALID_PLAYER_ID;
CMD:creategate(playerid, params[])
{
new string[128], object;
if(!gPlayerLogged[playerid]) return SendClientMessage(playerid, COLOR_GREY, "Komutları kullanmak iзin цnce giriş yapmanız gerekmektedir.");
if(PlayerInfo[playerid][pAdmin] < 6) return SendClientMessage(playerid, COLOR_GREY, "Bu komutu kullanma yetkiniz yok.");
if(sscanf(params, "i", object)) return SendClientMessage(playerid, COLOR_GREEN, "[+]{FFFFFF} /creategate [objectid]");
for(new idx=1; idx<MAX_GATES; idx++)
{
if(!GateInfo[idx][gModel])
{
GetPlayerPos(playerid, GateInfo[idx][gCX], GateInfo[idx][gCY], GateInfo[idx][gCZ]);
GateInfo[idx][gModel] = object;
GateInfo[idx][gCX] = GateInfo[idx][gCX] + 2;
GateInfo[idx][gCY] = GateInfo[idx][gCY] + 2;
GateInfo[idx][gCRX] = 0;
GateInfo[idx][gCRY] = 0;
GateInfo[idx][gCRZ] = 0;
GetPlayerPos(playerid, GateInfo[idx][gOX], GateInfo[idx][gOY], GateInfo[idx][gOZ]);
GateInfo[idx][gOX] = GateInfo[idx][gOX] + 2;
GateInfo[idx][gOY] = GateInfo[idx][gOY] + 2;
GateInfo[idx][gORX] = 0;
GateInfo[idx][gORY] = 0;
GateInfo[idx][gORZ] = 0;
GateInfo[idx][gStatus] = 0;
format(GateInfo[idx][gPassword], 256, "");
GateInfo[idx][gSpeed] = 2;
// Creating
format(string, sizeof(string), "Gate ID: %d", idx);
GateInfo[idx][gGate] = CreateDynamicObject(GateInfo[idx][gModel], GateInfo[idx][gCX], GateInfo[idx][gCY], GateInfo[idx][gCZ], GateInfo[idx][gCRX], GateInfo[idx][gCRY], GateInfo[idx][gCRZ]);
GateInfo[idx][gText] = CreateDynamic3DTextLabel(string, COLOR_WHITE, GateInfo[idx][gCX], GateInfo[idx][gCY], GateInfo[idx][gCZ], 10);
// Text
format(string, sizeof(string), "AdminUyarı:%s adlı admin %d id'li gateyi oluşturdu!. (Object: %d)", GetPlayerNameEx(playerid), idx, object);
SaveGates();
SendAdminMessage(COLOR_RED, 1, string);
Log("logs/gates.log", string);
idx = MAX_GATES;
}
}
return 1;
}
GateInfo[idx][gOwner] = INVALID_PLAYER_ID;