stock Float:GetPosFromPlayer(playerid, &Float:x, &Float:y, Float:distance, mode = 0) {new Float:A;GetPlayerPos(playerid, x, y, A);if(IsPlayerInAnyVehicle(playerid)) GetVehicleZAngle(GetPlayerVehicleID(playerid), A);else GetPlayerFacingAngle(playerid, A);switch(mode) { case 0: x += (distance * floatsin(-A, degrees)), y += (distance * floatcos(-A, degrees));case 1: x -= (distance * floatsin(-A, degrees)), y -= (distance * floatcos(-A, degrees));case 2: x -= (distance * floatsin(-A, degrees)), y += (distance * floatcos(-A, degrees));case 3: x += (distance * floatsin(-A, degrees)), y -= (distance * floatcos(-A, degrees));}return A;}
AttachDynamicAreaToPlayer(areaid, playerid);
Egyszerûbb ha streamert használsz, és: AttachDynamicAreaToPlayer(areaid, playerid);
COMMAND:four(playerid){newFloat:a_,Float:x_,Float:y_,Float:z_;GetPlayerPos(playerid, z_, z_, z_);GetPlayerFacingAngle(playerid, a_);for(new i; i < 4; i++){GetPosFromPlayer(playerid, x_, y_, 8.000, i);CreateVehicle(411, x_, y_, z_ + 1, a_, -1, -1, 60000000);printf(\"x: %f y: %f\", x_ , y_);}return 1;} stockGetPosFromPlayer(playerid, &Float:x, &Float:y, Float:distance, mode = 0){new Vehicle_ID = GetPlayerVehicleID(playerid),Float:a;if(Vehicle_ID){ GetVehiclePos(Vehicle_ID,x,y,a); GetVehicleZAngle(Vehicle_ID, a);} else {GetPlayerPos(playerid, x, y, a);GetPlayerFacingAngle(playerid, a);}switch(mode) { case 0: a = floatadd(a, 45.0000), printf(\"mode. %d - %f\", mode, a);case 1: a = floatadd(a, 135.0000), printf(\"mode. %d - %f\", mode, a);case 2: a = floatadd(a, 225.0000), printf(\"mode. %d - %f\", mode, a);case 3: a = floatadd(a, 315.0000), printf(\"mode. %d - %f\", mode, a);}if(a > 360) a = floatsub(a, 360);printf(\"%f\", a);x += (distance * floatsin(-a, degrees));y += (distance * floatcos(-a, degrees));}
Bogozd ki, nincs kedvem kiszedni belõle a felesleget. COMMAND:four(playerid){newFloat:a_,Float:x_,Float:y_,Float:z_;GetPlayerPos(playerid, z_, z_, z_);GetPlayerFacingAngle(playerid, a_);for(new i; i < 4; i++){GetPosFromPlayer(playerid, x_, y_, 8.000, i);CreateVehicle(411, x_, y_, z_ + 1, a_, -1, -1, 60000000);printf(\"x: %f y: %f\", x_ , y_);}return 1;} stockGetPosFromPlayer(playerid, &Float:x, &Float:y, Float:distance, mode = 0){new Vehicle_ID = GetPlayerVehicleID(playerid),Float:a;if(Vehicle_ID){ GetVehiclePos(Vehicle_ID,x,y,a); GetVehicleZAngle(Vehicle_ID, a);} else {GetPlayerPos(playerid, x, y, a);GetPlayerFacingAngle(playerid, a);}switch(mode) { case 0: a = floatadd(a, 45.0000), printf(\"mode. %d - %f\", mode, a);case 1: a = floatadd(a, 135.0000), printf(\"mode. %d - %f\", mode, a);case 2: a = floatadd(a, 225.0000), printf(\"mode. %d - %f\", mode, a);case 3: a = floatadd(a, 315.0000), printf(\"mode. %d - %f\", mode, a);}if(a > 360) a = floatsub(a, 360);printf(\"%f\", a);x += (distance * floatsin(-a, degrees));y += (distance * floatcos(-a, degrees));}