Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CMD:createobject(playerid,params[]){
- new modelid;
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED,"Sorry but you are not authorised to use this command");
- if(sscanf(params, "i" ,modelid)) return SendClientMessage(playerid, COLOR_YELLOW,"Usage: /createobject <Model ID>");
- new Float:x,Float:y,Float:z;
- GetPlayerPos(playerid,x,y,z);
- for(new i=0; i<MAX_OBJ;i++){
- if(!ObjCreated[i]){
- objectz[i]=CreateDynamicObject(modelid,x+2,y,z,0,0,0);
- new str[128];
- format(str,sizeof(str),"You have created a object(ID:%d) with Model ID:%d",i,modelid);
- SendClientMessage(playerid, COLOR_BLUE,str);
- new Float:x1,Float:y1,Float:z1;
- GetObjectPos(objectz[i],x1,y1,z1);
- new Float:x2,Float:y2,Float:z2;
- GetObjectRot(objectz[i],x2,y2,z2);
- ObjCreated[i]=true;
- gobject[i][model]=modelid;
- gobject[i][posx]=x1;
- gobject[i][posy]=y1;
- gobject[i][posz]=z1;
- gobject[i][rotx]=x2;
- gobject[i][roty]=y2;
- gobject[i][rotz]=z2;
- SaveFile(i);
- break;
- }
- }
- return 1;
- }
- SavePath(objectid){
- new str[10];
- format(str, sizeof(str),Path,objectid);
- return str;
- }
- forward SaveFile(objectid);
- public SaveFile(objectid){
- new INI:file = INI_Open(SavePath(objectid));
- INI_WriteInt(file,"model",gobject[objectid][model]);
- INI_WriteFloat(file,"posx",gobject[objectid][posx]);
- INI_WriteFloat(file,"posy",gobject[objectid][posy]);
- INI_WriteFloat(file,"posz",gobject[objectid][posz]);
- INI_WriteFloat(file,"rotx",gobject[objectid][rotx]);
- INI_WriteFloat(file,"roty",gobject[objectid][roty]);
- INI_WriteFloat(file,"rotz",gobject[objectid][rotz]);
- INI_Close(file);
- return 1;
- }
Add Comment
Please, Sign In to add comment