pawn Код:
YCMD:createdd(playerid, params[], help)
{
if(PlayerInfo[playerid][pAdmin] < 5) return SCM(playerid, COLOR_RED, "You are unathourized to do this command");
new ownerid;
if(sscanf(params, "i", ownerid)) return SCM(playerid, COLOR_GREY, "/createdd [playerid]");
if(!IsPlayerLoggedIn(ownerid)) return SCM(playerid, COLOR_GREY, "This player is not logged");
for(new dd = 0; dd < MAX_DDOORS; dd++)
{
if(!DynamicDoor[dd][ddCreated])
{
new Float:gPos[4], string[200];
GetPlayerPos(playerid, gPos[0], gPos[1], gPos[2]);
GetPlayerFacingAngle(playerid, gPos[3]);
DynamicDoor[dd][ddCreated] = 1;
format(DynamicDoor[dd][ddOwner], 32, "%s", RPNU(ownerid));
format(DynamicDoor[dd][ddName], 50, "%s Door", RPNU(ownerid));
new hashpass[129];
WP_Hash(hashpass,sizeof(hashpass), "123");
format(DynamicDoor[dd][ddPassword], 12, "%s", hashpass);
DynamicDoor[dd][ddPasswordSwitch] = 0;
DynamicDoor[dd][ddEnt][0] = gPos[0];
DynamicDoor[dd][ddEnt][1] = gPos[1];
DynamicDoor[dd][ddEnt][2] = gPos[2];
DynamicDoor[dd][ddEnt][3] = gPos[3];
DynamicDoor[dd][ddEntVW] = GetPlayerVirtualWorld(playerid);
DynamicDoor[dd][ddEntInt] = GetPlayerInterior(playerid);
new ORM:ormid = DynamicDoor[dd][ORM_ddID] = orm_create("dynamicdoors");
orm_addvar_int(ormid, DynamicDoor[dd][ddID], "ID");
orm_setkey(ormid, "ID");
orm_insert(ormid, "OnDoorCreated", "d", dd);
DynamicDoor[dd][ddEntPickup] = CreateDynamicPickup(1318, 1, DynamicDoor[dd][ddEnt][0], DynamicDoor[dd][ddEnt][1], DynamicDoor[dd][ddEnt][2], DynamicDoor[dd][ddEntVW], DynamicDoor[dd][ddEntInt], -1, 100.0);
DynamicDoor[dd][ddExPickup] = CreateDynamicPickup(1318, 1, DynamicDoor[dd][ddEx][0], DynamicDoor[dd][ddEx][1], DynamicDoor[dd][ddEx][2], DynamicDoor[dd][ddExVW], DynamicDoor[dd][ddExInt], -1, 100.0);
format(string, sizeof(string), "%d for %s was created", dd, RPNU(ownerid));
SCM(playerid, COLOR_GREEN, string);
dd = MAX_DDOORS;
}
}
return 1;
}
public OnDoorCreated(dd)
{
//DynamicDoor[dd][ddID] = cache_insert_id();
//printf("DoorCreated: %d", DynamicDoor[dd][ddID]);
printf("Player %d signed up and their ID value is %d.", dd, DynamicDoor[dd][ddID]);
return 1;
}